Keeping Power Spectrum Peaks on a Graph

Hello,
I am trying to read in a signal which varies in frequency as time progresses. I am taking this function and running a real time power spectrum (FFT Power Spectrum.vi) on it. As time goes the peaks move around according to teh frequency which is coming in. What I want to do is to keep the old peaks on the graph as the new peaks come in. So for example if I had a signal which was at 50 htz then 75 htz, at the end of the run I want to see both peaks on my grpah. Is this possible? Thanks.
Intern NSWCCD Carderock.

If you use the Spectral Measurements Express VI, you can configure it to do peak hold. In the configuration screen, turn averaging on, click on the Peak Hold radio button, and set the averaging number to 1. Then all your peaks will be displayed as they come and go. See attached vi. If you want to see how the express vi does it, you can convert the express vi to a normal vi and then look into the block diagram. I believe one of the functions has a peak hold input.
- tbob
Inventor of the WORM Global
Attachments:
SpectralMeasure.vi ‏98 KB

Similar Messages

  • Power Spectrum peak calculator

    Hi,
    I am using the "fft power spectrum.vi" to calculate an FFT on a wave and the output of that is some bundled wire called power spectrum. I was wondering is there an easy way to take this output and find and display all the various peaks in the power spectrum? Thanks.
    Intern NSWCCD Carderock.

    Yes, I did try that, but the problem is I don't understand the inputs required for it as it requires
    "X" a set of points, but when you run the power spectrum you get a bundled wire with various parts and I'm not
    sure which of these to wire into the peak detector as everything I have tried has given me wierd values. Thanks for
    any help.
    Intern NSWCCD Carderock.

  • Power Spectrum no longer working correctly after upgrading to 8.0.1

    Recently, I installed Labview 8.0.1 to correct a problem I was experiencing in 8.0.  The installation resolved my problem, but now the Power Spectrum no longer gives the correct result.  My program has not changed other than the update.  I checked my circuit and everything is functioning properly.  Before changing to 8.0.1 the power spectrum peaked at 40Hz and 80Hz,  which was correct, and now it peaks at 0Hz and 10Hz.  On top of everything, the peaks are much higher than they should be.  I expect peaks with a max of 2.5millivolts and now they are 1volt.  I don't understand what is going on. Nothing changed, but the software version.  Can someone please help me? 

    In addtion to Altenbach's comments - 
    I'd recommend trying another VI function to get the power spectrum for
    your signal to see if the behavior is the same.  You can find some
    examples of VIs using the power spectrum functions using the NI Example
    Finder.
    You can go to LabVIEW's Example Finder by going to Help >> Find Examples.
    Then search for FFT. There should be some results that include FFT and
    Power Spectrum Units.vi, Power Spectrum Measurement.vi, Basic Spectral Measurements.vi,  and Spectrum Measurements.vi. Try opening and
    running these examples to see if the VIs are returning the proper
    results.
    Mark Walters
    Application Engineer
    National Instruments

  • Power Spectrum

    Ok here's the deal.. I acquire data (of type numeric array) from an acuqisition unit (the specifics of it aren't important for the problem) at a known sampling rate and wish to perform a power spectrum on this data. I've used the build waveform function to build a waveform from the 1D array of data with the addition of the dt value (1/Fs) and a timestamp and fed this waveform into the power spectrum vi. The spectrum is then plotted on a waveform chart.
    However each time a new data set arrives from the acuqisition unit, the chart is overwritten.I would like to keep the previous data but would prefer not to use shift registers due to the possible size of the array. I thought if the chart's type was a "strip chart" it would hold the data until the buffer is reached but this doesn't seem to be the case.
    Another possible issue is with the timestamp but I think I've accounted for that.
    Note: The attached vi won't run successfully due to not being connected the the acquisition unit. I was hoping the problem might be clear to someone with more experience using the power spectrum function. I have used it successfully with generic sine waves.
    Strokes
    Attachments:
    Power Spectrum.vi ‏19 KB

    Strokes,
    you listen to mp3 music from time to time? Maybe, you have configured your application playing those mp3 to display something called "Bars and Waves" (at least, Microsoft calls it like this in Media Player). This display is comparable to an equalizer view.
    Your display of the power spectrum analysis is really comparable to this
    Does it make sense that the graph does not replace (read: update) instead of "concatenating"? 
    Norbert 
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Power Spectrum VI Performance

    I am looking to accelerate the performance of the Power Spectrum and
    Peak Finder VI's in LabVIEW.  Right now to process 10000 points
    the power spectrum takes 1.3 Miliseconds.  While this number is
    not huge, when doing 3000 of these analyses in a shot, it gets large,
    quickly.  I would like to know if there's anything to be done to
    speed it up.  For example, the nubmers i am sending it are fairly
    small Single Precision Floats, would it work better with larger
    numbers?...
    Thanks for all your thoughts in advance.
    Eugene

    Hi
    I read in some place, and time ago, that those vis (power spectrum,fft, psd, etc) are optimized for power of 2 number points. I am not sure if this keeps being true, but you can try to use, say, 8192 points, or zero pading to 16384 to see if speed increases.
    Hope it helps.
    Alipio
    "Qod natura non dat, Salmantica non praestat"

  • Save Power spectrum

    Hi
    I would like to save a power spectrum ( about 80000 lines of data) as a file that i can later plot. When i write the cluster (coming out of FFT Powerspewctrum.vi)  to an excel  (excel works only upt o 56000 or something like that, so i can´t use it anyways) or .txt file using the a combination of open -write -close  file i get weird number and letters and not the data i´d like to have. Which data format ( iwould like to make graphs in origin) and vi´s should i use to export the spectrum or is it the best to extract the y-value of the spectrum (magnitude) using the unbundle by name .vi  and export it as txt?
     Thanks for any help

    I believe this is also something i can use for my application, however, when trying to recreate the code in LabVIEW 2011 SP1, the connections between the For Loop and the Close File return an error that the data types are different.The Path wire returns that the source is 1-D array of byte stream file reference with the sink being byte stream file reference. The Error wire returns that the source is 1-D array of cluster of 3 elements with the sink being a cluster of 3 elements.  How would i go about fixing this?
    I plan on using this to write to the file from an accelerometer connected to a NI-9234 c-series module through a cDAQ-9178 usb chasssis.  So my intention is to use this as a subVI to connect the accelerometer signal from the DAQ Assist of another VI.  I am trying to record the spectral data. Attached is the attempt at recreating your code.
    Attachments:
    Save Power Spectrum.vi ‏55 KB

  • Need Help related to Power Spectrum of two signal

    Hello Sir, 
    I have two signals of different frequencies but i want to take the FFT power spectrum of both signals at same graph . So for that case i take the FFT power spectrum of both signal indivisualy and after this build the array. so i got the one graph and all the components in same graph. Now
    The problem is that in that graph i want to extract the magnitudes at each frequency, but when i extract the information from final graph it will be the " 1D array of Cluster of 3 Elements" so its information is saprate for these two signal. but i want to tale the magnitude at each frequency , how can i got this sir . Please Help me 
    Agnivesh

    Sir it works thanks but there is one new problem is that wahen i am going to extract the magnitude for every frequency it is also works, but my question is that if my frequency is in floating point then how can i extract magnitude for that frequency. i mean i extracted the magnitude for every frequency component starting from 0 to 1...2..3...4.............so on (Frequency ) but if my frwquency id 2.3Hz so how can i do this.i am sending you my VI also 
    Agnivesh
    Attachments:
    Analysis HP Compressor test 1.vit ‏3485 KB

  • WAV power spectrum

    I am conducting a sound measurement test using a IEPE microphone and the NI USB 9233. I used the SVXMPL_WAV Recorder (DAQmx).vi to record a Wav file of the sound and then the SVXMPL.WAV Power Spectrum.vi to produce a power spectrum of the wave file. I had a concern that scaling was occurring because the spectrum seemed louder than expected. I read in another thread that no scaling occurs in the vi. Next I used SVMPL_FFT Subset (DAQmx).vi to produce a power spectrum over the same frequency range (20 to 20,000 Hz). In general, the two method agree well except that the peaks in the spectrum are at lower frequencies for the WAV Power spectrum vi than that obtained for the SVMPL_FFT vi. I was wondering if any one could please explain why this is occurring?
    Regards,
    Bill

    Hello Bill!
    Thanks for your posts back and the information. So what I have done is I ran approx 1 KHz signal through a series of different programs to see if I could reproduce anything you were seeing. I also used the program you posted as well. However when I run the  WAV Recorder (DAQmx) vi and then put that wave file into the WAV Power SPectrum I see the signal at about 1KHz like I expect. Then I aslo use your program to see if I can get the same results with the same function generated signal. I always se my signal in the same matter and the frequency components line up accordingly. See the pictures attached below. Thanks for posting your code and it seems like I am unable to reproduce what you are seeing. Did you make any changes to the VI's in your code? If you could perhaps post the wav files that you are producing to see what I can make of them? Take a look at the screen shots that I was able to produce. 
    Cheers!
    Corby_B
    http://www.ni.com/support 
    Attachments:
    Power Spectral Density.jpg ‏225 KB
    WAV Power Spec.jpg ‏202 KB
    Power Spectrum.jpg ‏142 KB

  • Convert power spectrum back to original waveform

    Hi,
    I have program my PXI 5610 to transmit a sine wave to my PXI 5600.
    But when I use the 'ni5660 Read Averaged Power Spectrum VI' to read the signal, it comes out as a power spectrum.. So how can I convert this power spectrum back into my sine wave to show it on the graph.
    I am new into this field, hopefully someone can help me out.
    Thanks.
    Jieyi
    Attachments:
    wiring.GIF ‏9 KB

    Hello Jieyi,
    When you read your signal as spectrum, you loose the phase data. You can still get your signal back but it would not have any information about the phase. I would suggest you acquire the time domain data. This is very simple since the driver can do everything for you.
    The time domain data will be automatically converted to In Phase (I) and Quadrature Phase (Q) which are two components that changes the carrier. You can read more about IQ signals here.
    Then, you can open the example called ni5660 Getting Started IQ.vi located under "\LabVIEW 8.x\examples\instr\ni5660" and look at this:
    Finally, if you have modulation toolkit, you can open any modulation example to transmit a sinewave. These are located at:
    "\LabVIEW 8.x\examples\Modulation\RFSG examples"
    For example, AM:
    Transmitter (Tx)
    MT RFSG Generate AM.vi
    Receiver (Rx)
    MT ni5660 Demodulate AM.vi
    These examples are ready to transmit any standard waveform including your sinewave.
    Hope these information helps,
    Message Edited by Yardov on 08-17-2007 06:50 PM
    Gerardo O.
    RF Systems Engineering
    National Instruments
    Attachments:
    acquire time domain signals.JPG ‏46 KB

  • Power Spectrum with RFSA

    Hi all,
    I have some question about fetching power spectrum with RFSA drivers.
    when i set span and resolution bandwidth as 100M and 1M respective in ni5660 Configure for Spectrum,and use ni5660 Read Averaged Power Spectrum to fetch the power spectrum,does averaged power spectrum output the 100M signal once?
    if so,how can i draw the spectrum in Waveform Chart as RFSA demo show us?RFSA demo did use Waveform Chart to draw spectrum,did't it?
    Thanks
    Liu Yuan

    Hello Liu Yuan,
    If you take a look at ni5660 Power in Band example in the LabView Example Finder ( Help -> Find Examples ), you will notice it uses a Waveform Graph.  The Read Averaged Power Spectrum vi is contained within a while loop which means that it will continuously output the averaged power spectrum.  If you want to use the RFSA drivers, I suggest looking at the RFSA Getting Started Spectrum example in the example finder.  This example only reads the spectrum once, but you could put a while loop around the read vi to get continuous spectrum output.  If you have any more questions feel free to post back.
    Regards,
    Benjamin Cook

  • FFT Power spectrum

    It appears that the project I'm working on will end up teaching me a lot about labview because the project is complicated.  Using labview, I am spinning two objects at two different speeds, which makes up the signal.  One object is being spun at 1200rpms and the other at 2400rpms.  This should yield a spike at 20Hz and one at 40Hz.  I have a spectrum analyzer which is giving me the results I expect, but I can't seem to get it with labview.  I tried using FFT and then taking the real portion of the signal and graphing it, which didn't work.  I then tried the power spectrum, which also didn't work.  I need some help/suggestions.  Any and all are appreciated. 
    Thanks,
    JB

    JB,
    To help you, we need some help. Specifically, some specifics about your application.
    How are you acquiring the signals from your spinning objects? What is your sampling rate? Are the signals sinusoidal, pulses from an encoder, something else?
    What did not work? Did you not get any spectrum, was the frequency wrong, was the amplitude wrong, was the resolution poor?
    If you post your VI with some typical data saved as default (because we do not have your spinning objects), someone will probably be able to help you.
    Lynn

  • Why do I get SVFA Power Spectrum error?

    Hello,
    I'm having trouble with acquiring sound data from a microphone using the PCI-4474 and the DAQ Assistant and analyzing with the Sound & Vibration toolkit in LabVIEW 8.5.1. Every so often, I'm getting the following error from the Power Spectrum Express VI:
    Error -1931 occurred at SVFA Power Spectrum (1 Ch).vi:4
    Possible reason(s):
    Sound & Vibration:  The number of samples should be greater than 0.
    One time I also got error -200284 at the DAQ Assistant VI. I know that normally means a timeout issue, but it shouldn't be timing out because I'm acquiring 299 samples @ 60 kS/s, and the timeout is set to 11 seconds. I don't think it's a trigger issue either because the problem only happens occasionally, at somewhat random times, and I'm not using an external trigger.
    What really stumps me is that I don't get this error every time, and if I click Continue on the error dialogs, it seems to return to normal, at least for a while.
    Any suggestions would be greatly appreciated.
    Thanks!
    David

    Hi PBear,
    Thanks for replying. I probably should have explained better. The reason I was trying to take a sample of data smaller than 0.8 ms is because of the method I was using to calculate the exact duration of the beep. For each set of samples, I used the SVL AC & DC Level VI to calculate the signal level, then if it was above a threshold I captured a time stamp. During each subsequent iteration of the while loop, I would keep thresholding the signal and capturing a time stamp until the signal fell below the threshold, at which point I would collect a final time stamp and subtract the first time stamp from it to get the duration. This method works, but it's only accurate to the duration of the samples collected (maybe not even that). I'm sure there's a better method but that was the only way I could think of at the time. Anyway, that's what I meant by time resolution -- resolving the duration of the beep. I didn't mean the actual time resolution of signal acquisition; I know that depends only on the sampling rate.
    Hopefully now I've explained it more clearly and you can see my dilemma. You're right, if I sampled at 200 kS/s, I would have a data point every 5 µs. The problem is, I need a signal level (i.e. RMS value), not just one data point. And I need RMS values in high enough time resolution that I can verify the duration of the beep to within 0.8 ms. That's why I was trying to run my acquisition loop so often, because I only get one RMS value for each loop iteration. That sounds like a pretty inefficient method, though. Is there a way to capture more data points per iteration but somehow chop them up into smaller groups in real time and get more RMS values per iteration? And then how would I know my time stamps are accurate? (Am I anywhere in the ballpark?)
    Thanks for your suggestion on the DAQ Assistant. I'll see what I can do there -- maybe that will eliminate some of the extra noise.
    Below I've posted the latest version of my VI -- it's a little cleaner than the one I posted yesterday. Take a look at it and maybe my explanation will make a little more sense.
    Thanks,
    David
    Attachments:
    test20080627.vi ‏447 KB

  • What are the units for the power spectrum output? (units in)^2/Hz?

    I can't seem to find the answer in the manual that came with the software or anywhere online.  Maybe I am just looking in the wrong places.
    Thanks
    David

    Hi David,
    I assume you are referring to the step, "Power Spectrum", in Analysis»Frequency Domain Measurements
    Per the help that I see, "This step can return the spectra in root-mean-square, peak, and peak-to-peak
    units."
    Also, in the configuration tab of the step, for magnitude you can select either dB or linear.
    Hope that helps!
    -Sam F, DAQ Marketing Manager
    Learn about measuring temperature
    Learn how to take voltage measurements
    Learn how to measure current

  • What is the difference between power spectrum and PSD?

    Hi all,
    I input a time domain signal to the FFT power spectrum VI and FFT PSD VI seperately, and got two  outputs in frequency domain with similar shapes but different magnitudes.
    I refer to some signal and system textbook, and find PSD(w)=1/pi*Power Specrum or equivalently PSD(f)=2* Power Specrum.But as I observed from the LabVIEW outputs, this relation is not correct. I input a 1KHz sin wave with amplitude=1, Fs=512KHz, #s=2048 , the PS peak is 0.5 and the PSD peak is around 0.013.
    So I wondered what's the real formula LabVIEW is using to calculate PSD?
    Sunny 

    PSD is related to spectrum resolution, thus related to sample rate.
    df= Sample rate/ #samples
    I think they follow this relationship:
    Amplitude FFT power spectrum = Amplitude PSD * df * 1.5

  • Raw time series with power spectrum

    I want to generate another VI with raw time series and power spectrum. Use soundgen.vi, with a sampling frequency of 1 kHz and datasize of 2000, so that it covers 2 sec.
    How do I display the raw time series data and a power spectrum of it? 
    Find the rest of the peaks and identify them. Why the peaks are where they are?
    Attachments:
    soundgen.vi ‏15 KB

    To start do a search in the examples that came with LV for FFT. This will show you a good cross-section of what LV has to offer in terms of analysis capabilities. The thing to remember is that you can perform this analysis on data directly from a device or post-process data that you read from a datafile. After going through the examples if you have specific questions, we'll be able to give more specific answers...
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Maybe you are looking for