LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I plot a line graph in Labview of the peaks of the harmonics detected in a frequency spectrum waveform?

Hi,
I am using a DAQ PCI 6024E device, which is attached to a signal generator with Labview at the moment. I have built a vi which currently shows the input waveform that is produced by the signal generator and the frequency spectrum showing the harmonics of the waveform on the screen. The problem is that I now want to plot a line graph of all the harmonics by using the peak of each harmonic. I have tried connecting a peak detector to the output of the power spectrum vi that I used but gives me an error saying "These cannot be wired together because their data types (numeric, array, string, cluster, etc.) do not match." How can I change this? Should I even be using the peak detector to achieve this plot? I am really stuck so Any help would be greatly appreciated..!

Thanks in advance

Barry
0 Kudos
Message 1 of 7
(4,123 Views)
Hello,

It's strange, because these vi's you mention can be easily connected to each other, one is returning a 1D array of data the other is expecting exactely the same data type.
Make sure you are not using the point by point peak detector witch expects a scalar in.
The "normal" peak detector is situated in: "Analyse" -- "Signal Processing" -- "Time Domain" group.

Hope this helps,
Paulo
0 Kudos
Message 2 of 7
(4,114 Views)
Sorry, I didn't saw that you attached you vi..
Your FFT power spectrum (And not Power spectrum) is returning a cluster of three elements:
f0 - Initial frequency;
df - delta frequency;
magnitude - Array of data points
So if you use unbundle by name you can easily get the magnitude array and connect it to the Peak detector.
Take care that the locations are then really located at f0 + i * df.

Hope this helps,
Paulo
0 Kudos
Message 3 of 7
(4,111 Views)
Thank you very much PauloM,I much appreciate the time you have used but I have a problem opening the file you sent to me as I am using LabView 6.1 and you are using 7.1.1?? How do I get around that?

Your help is much appreciated!!

Thanks in Advance
Barry
Message 5 of 7
(4,103 Views)
Hello Barry,

That is really a problem, in LabVIEW, we can only convert vi to the previous version, I have version 7.1 and so I can only convert to version 7.0 and you cannot open this too.
But I think that it's very easy to do what I'm trying to explain you.
Go to the cluster group in the functions pallete. Place an unbundle by name function in the diagram and connect it to the data that's comming out of the FFT Power spectrum vi - the pink (or watever) wire.
Click in the white part of it (it should contain something like f0), choose magnitude.
This is now an array that you can connect to the peak detector function.
Take care about the threshold and width parameters of the peak detector.
Take a look at your signal and decide the amplitude and width of the peaks you want to detect. The threshold is the amplitude above what you consider as a peak, the width is a little bit more complicated - to begin, 3 or 4 should be a good number if you signal is not too noisy - bigger widths will somehow do a kind of a low pass filtering to your signal.
The position output of your peak detector is an array of locations where your peaks were found.
Keep in mind you are now working in frequency domain and that position means something in the frequency domain.
The array you placed as input of the peak detector is an array of points starting in f0 and separated by df (the other elements of the cluster).
So to calculate the real value of the peaks, you have to multiply them by df and add them f0.

Sorry by the big text and sorry if I went too much in detail,
Hope it helps,
Paulo
0 Kudos
Message 6 of 7
(4,087 Views)
Thank you very much Paulo thats brilliant works perfect now!

Thank you very much!
Barry
0 Kudos
Message 7 of 7
(4,074 Views)