LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scaling frequency domain Waveform Graph

Solved!
Go to solution

Hi everyone,

 

-I´m acquiring a voltage random signal by using a sample rate of 200 KS/s on my NI device, and plotting the acquired signal on a Waveform Graph (Figure 1-a). After sampling the voltage random signal my Labview VI also calculates the PSD (Power Spectral Density) from the acquired random signal and plots it on a Waveform Graph (Figure 1-b). As the used sample rate was set at 200 KS/s, the maximum value presented on the x-axis of the PSD´s Waveform Graph should be 100 kHz (according to Shannon´s theorem). When Labview plots the PSD´s Waveform Graph, the maximum value appears as 1. Is there any way to scale the PSD´s Waveform Graph in order to set the maximum value on its x-axis as 100 kHz?

 

Thank you in advance,

 

Best regards!

0 Kudos
Message 1 of 7
(4,867 Views)
Solution
Accepted by topic author pinguim

Sure, scale your numbers correctly and use an X axis Range property node. (Your pdf tells absolutely nothing about your program or your problem with it. Code would at least tell us something.)

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 2 of 7
(4,855 Views)

Hi Camaron,

 

-Thank you for your fast reply and the tip with "property node". It works for the value of 100 kHz (see attachment). However, when I set the value of the "X axis Range property node" to higher values (p.ex. 200 kHz), Labview does not plot that value as the maximum on the x-axis of the PSD Waveform Graph. Why does it happen?

-The .pdf file (which I sent previously) just illustrates the maximum value I´ve got on the x-axis of the PSD earlier.

 

best regards!

0 Kudos
Message 3 of 7
(4,823 Views)

Hi,

 

Just an observation from my last reply: ....."However, when I set the value of the "X axis Range property node" to higher values (p.ex. 200 kHz, when using a sample rate of 400 kS/s), Labview does not plot that value as the maximum on the x-axis of the PSD Waveform Graph. Why does it happen?

 

best regards!

0 Kudos
Message 4 of 7
(4,822 Views)

Not sure. You read up, I'll read up, and get back on Monday.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 5 of 7
(4,805 Views)

Several items:

1. By using the array to Dynamic Data Type conversion (which has no input for timing information) you get default timing on your time graph.  If you set the DAQmx Read VI to produce a waveform rather than an array, the timing information is included in the waveform.

2. Because no timing information is provided to the PSD VI, it uses default timing = 1 sample per second. As in 1, use waveform,

3. The way you build the array in the loop cause frequent memory re-allocations and will likely slwo down and eventually cause the VI to fail with an Out of Memory error. You also write the same data to the file repeatedly, making the file much larger than it needs to be.  I man not sure what you intend with the data so I am nout sure how to fix this.

4. The boolean line to the case structure will always be true. So the case structure is not needed.

5. When using waveforms you do not need to explicitly set the Scale Maximum or Scale Multiplier. You set one with a property node and the other from the graph properties dialog.  I reset them to default and everything scales properly.

 

I do not have DAQmx or your hardware device so I used the Sine Waveform.vi to simulate a signal. The images below show how it can work. 

 

Lynn

 

Scale graph.png

 

Scale FP.png

0 Kudos
Message 6 of 7
(4,796 Views)

Hy Lynn,

 

-Thank you for your prompt reply and all the tips. Below the answer to the points you´ve mentioned on your reply.

 

1. By using the array to Dynamic Data Type conversion (which has no input for timing information) you get default timing on your time graph.  If you set the DAQmx Read VI to produce a waveform rather than an array, the timing information is included in the waveform.

 

I´ve set the “DAQmx Read VI” to produce a waveform rather than an array (as proposed on your last reply) and carried out the changes you mentioned. When running the VI with such changes, the VI does not plot the whole time history of the sampled signal. For example, I acquired the signal during 10 s, and what I got on the Waveform Graph was just an incomplete signal as shown in fig. 1. Attached to this reply I´m also sending you the VI with the proposed corrections. How can I plot a real time sampled signal (during acquisition of the signal) which allows me to see the complete time history of the signal after pressing the button “stop acquisition”?

 

2. Because no timing information is provided to the PSD VI, it uses default timing = 1 sample per second. As in 1, use waveform,

 

After implementing the proposed changes on my VI, the maximum value on the x-axis of the PSD appears too high than expected (see fig. 1). How can I solve this problem?

 

3. The way you build the array in the loop cause frequent memory re-allocations and will likely slwo down and eventually cause the VI to fail with an Out of Memory error. You also write the same data to the file repeatedly, making the file much larger than it needs to be.  I man not sure what you intend with the data so I am nout sure how to fix this.

 

I just intend to plot an acquired signal in time domain and see its complete contend on a graph (whatever the graph available for that in Labview) after pressing the button “stop acquisition”. I don´t really know what could be a better strategy to achieve that goal. If possible, could you please show me another method to accomplish that in an optimized way?

 

4. The boolean line to the case structure will always be true. So the case structure is not needed.

 

Ok! Understood.

 

5. When using waveforms you do not need to explicitly set the Scale Maximum or Scale Multiplier. You set one with a property node and the other from the graph properties dialog.  I reset them to default and everything scales properly.

 

 Ok! I deleted the property node in that VI, which I sent to you. I´ll try to test it again tomorrow, and let you know about the results.

 

I do not have DAQmx or your hardware device so I used the Sine Waveform.vi to simulate a signal. The images below show how it can work. 

 

Ok! Good idea! The plot seems ok for the Sine Waveform.vi, but unfortunately I did not get so far good results for my random signal with regard to scale on x-axis.

 

Best regards!

Download All
0 Kudos
Message 7 of 7
(4,760 Views)