LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph displaying problem

Hello,

                I have a power spectrum which would like to separate high peaks and small peaks. I am running my code as "N samples read " option in DAQ assistance. Probably I get 1000 samples and array should show 1000 elements as length instead of it showing 500. As long as, I separated high peaks and low peak values and could able plot separately in graph. I have done everything correct. Can some one help me here.

I would like to plot separate graphs with one containing high magnitude peaks with respect to frequency and other as smaller ones.

0 Kudos
Message 1 of 8
(3,477 Views)

SInce no one replied. I struck here for a while. Please help me or am I doing any wrong.

0 Kudos
Message 2 of 8
(3,471 Views)

First of all, your code includes quite some Rube Goldberg segments.

 

The explanation for your question regarding the array size is quite simple: mathematics.

You are right, that a Fourier Transformation of a signal will result in as many frequency values as the original time signal has values. So if your time domain signal has 1000 values (data points), the result of FFT will also have 1000 values in the frequency domain.

 

The following code will have the result displayed in the second image:

FFT Code.PNG

FFT Result.PNG

 

As you can see in the FFT {X} graph, the result has 1000 points, but they are "mirrored" at 500. This is mathematical the nyquist frequency, so sampling rate/2. To the left, you have the positive frequencies (mathematics with complex numbers), to the right you have negative frequencies.

 

I am not sure if this simplified 'explanation' is mathematically completly correct, but you should get the picture.... and calculating the Power Spectrum uses only positive frequencies. You can dig into FFT Power Spectrum and PSD for N Chan.vi >> ma_FFT Power Spectrum and PS Density no State.vi >> ma_One-sided Power Spectrum.vi (in the "No averaging" case) >> ma_Convert to One-sided Spectrum (real).vi.

This vi in the end of this "chain" cuts of the "negative frequency spectrum" effectively cutting down your number of values to 1/2, in your case 1000/2 = 500.

 

So this is definetly works as expected.

 

I don't get the point of the high and low peaks....

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 8
(3,440 Views)

Thank you so much and I understand my self this reason(about 500 points) after posting here.

I would like to separate my Power Spectrum graph into two graphs i.e.. One graph represents the high peak values and another graph represents low peaks values.

But I have a problem with my two graphs that they have to plot my two arrays, which contains high peak magnitude values in one array and low peak magnitude values in another array.

Instead of plotting peaks it is just plotting a linear graph which follows the array values. I know that liner graph plot is correct but is there any way to plot as peaks in my power sprectrum. 

 

0 Kudos
Message 4 of 8
(3,429 Views)

Your program does exactly what you telling it to do. So you are telling the wrong things....

 

You are currently:

1. Sort the result of the power analysis (500 data points) in ascending order.

2. You split the sorted array into two different arrays using a threshold.

3. You create a graph display for both new arrays including some scaling.

 

You totally loose the frequency information by this sorting. You must not sort the result of the power analysis or you have to figure out a way to maintain the relation between 'value' and 'frequency'.

 

Why do you want to split up the power analysis at all? What's the purpose?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 8
(3,423 Views)

OH! I am sorry to say this. It is long story and can't type here again. I have some good peaks on the spectrum which represents the noiseless frequencies and remaining small peaks are noise. I know that I can use filters but I tried all those ways from 2 months and came with this idea.

 

Everytime, I need to sort my good peaks from that low peaks and then I try do reduce noise on my serial device. When ever I reduce the noise on my serial and I have only some good peaks left in the spectrum(now those are in array).

 

Anyway, I have one more problem that about array summation value. I have 240 elements in an array which I calculated sum of all those elements. The array is continuously updated from DAQ and therefore the summation value is also varying always in between some points. For example, If the summation value is 0.1, my serial device is fixed to some value and  if it is 0.09 it fixed to some other value. This is making inefficient adjustment to my serial device because the fast variation of this summation. How can I stabilize this value. I think average will fix my problem.

0 Kudos
Message 6 of 8
(3,415 Views)

Sorting the result of the power spectrum is nonsense. You loose all information about the frequencies so this is not the way to go.

What you have to do is something like the following:

1. Analyze your power spectrum for peaks and categorize them in "signal" vs. "noise".

2. Compute the frequency for each of those peaks (index * df + f0).

3. Create two "lists" with those frequencies.

 

Summing array elements will always "jitter" if the values in the array change. So you introduce an additional source of "noise" by this. Averaging is a good method to flatten the impact, nevertheless, you will still see the values to jitter. And if the values you want to differentiate between are quite close together, there is a risk that you will never be able to determine wether your current value fits to the one or the other state. This is because averaging again introduces uncertainties.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 8
(3,400 Views)

I am glad to here your suggestions. I don't care about frequencies at the moment. I am concentrating on only magnitudes. So, only am doing in this way.

0 Kudos
Message 8 of 8
(3,397 Views)