Frequency Response using Swept Sin

Does anyone have sample C/C++ code to generate a swept sin wave and get the frequency and phase response data using NI-DAQmx on a PCI-4461 board?
Currently I'm using a PCI-4551 board and can use the helpful NI-DSA C API to do this, but the 4551 card is now obsolete so I need to replace it with the 4461.
Thanks in advance!

If you check the help text for sine wave.vi you'll see that it generates the sine wave based on the following formula:
yi = a*sin(phase[i])
for i = 0, 1, 2, …, n – 1 and where
a is amplitude,
phase[i] = initial_phase + f*360*i
This means that when you input a=1, f=0,1 and initial_phase=0 you will get a sine wave that is based on samples at every n*36 degrees; i.e. at 0, 36, 72 etc...due to this sample rate you never see the full amplitude (+/- 90 degrees), the wave is clipped at the top. If you input an initial phase of 64 degrees you will get the full amplitude, but the wave is still deformed due to digitalization...
The lower the frequency you put in, the closer the digitalized representation will be to the true sine.
Use the Waveform Generator VIs from the analyze palette if you want to have more control over the wave generation (sample rates etc.). (Not available if you have the base package.)
MTO

Similar Messages

  • Calculate frequency response using FFT and inverse FFT

    Hi,
    Attached is the program using FFT and inverse FFT to filter a time domain signal. The frequency response of the LPF can be obtained by using the chirp signal from 0 to 5kHz. However, I don't know why the signal obtained from a sine wave input is so strange. The amplitude is wrong and has a envelope outside. Please help to point out what's wrong with that.
    Bill
    Attachments:
    fft filter.vi ‏87 KB

    If you check the help text for sine wave.vi you'll see that it generates the sine wave based on the following formula:
    yi = a*sin(phase[i])
    for i = 0, 1, 2, …, n – 1 and where
    a is amplitude,
    phase[i] = initial_phase + f*360*i
    This means that when you input a=1, f=0,1 and initial_phase=0 you will get a sine wave that is based on samples at every n*36 degrees; i.e. at 0, 36, 72 etc...due to this sample rate you never see the full amplitude (+/- 90 degrees), the wave is clipped at the top. If you input an initial phase of 64 degrees you will get the full amplitude, but the wave is still deformed due to digitalization...
    The lower the frequency you put in, the closer the digitalized representation will be to the true sine.
    Use the Waveform Generator VIs from the analyze palette if you want to have more control over the wave generation (sample rates etc.). (Not available if you have the base package.)
    MTO

  • 3 Simultaneous Frequency responses using PCI-4552

    I need to obtain 3 simultaneous frequency responses (Magnitude and Phase) using a PCI-4552 board. Ch 1 is the reference for the 3 FR's. I succeded in obtaining independent FR's, but I cannot configure the vi with the 3 FR's together. I attach my best try, please take a look at it.
    Attachments:
    zoom4.vi ‏378 KB

    I took a look at your VI. It looks like you have two issues.
    First, you are using a single stop button's input to stop several loops. The problem is that the output of the button will not allow the consecutive while loops to execute until the first one has finished (they are waiting for the prior loop to finish to get the final value of the button). If you want to read the value of a single button simultaneously in several while loops, you need to use local/global variables.
    You should have an example:
    Stopping Parallel While Loops with Reset.vi
    ... included with LabVIEW which will demonstrate how to properly do this.
    Your second issue is that the base analyzer can only do two simultaneous channels. If you really need to do more, you'll need to grab al
    l the channel's raw data using the DAQ API instead of the DSA API, and feed the individual captures into the "Frequency Response Function (Mag-Phase)" vi. This should give you the same results, but you'll be using the host computer to do the analysis instead of the board.

  • Microphone's frequency response

    Hi,
    Is it possible to plot a microphone's frequency response using sound and vibration? If it's possible, can anyone tell me how?
    Thanks

    Hi popcorn,
    If you have the Sound and Vibration Assistant with SignalExpress, there is a step you can add under Analysis - Frequency Domain Measurements called, Frequency Response.
    Here's a link to an article that discusses various functions, Sound and Vibration provides.  Although the article discusses LabView, many of the same functions are found in SignalExpress as well.  The Frequency Response Function can be found at the bottom.
    http://zone.ni.com/devzone/cda/tut/p/id/3030
    Aki T.

  • Spectrum Analyzer using Swept Frequency

    Using the AWESOM example foundhere:
    http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/433c2cbc5a1c4a49862569500035f715?OpenDocument
    Give the person who wrote that an A+. I want to replace the FIR filter with a REAL device. I want to send a swept sin wave (just like the original) and then read the response from the Analog Input channel. I put a vi in place of the vi called :IIR Filter for 1 Chan.vi. Go to the NI ftp site to ge t the file named ZZDMKSin.zip (I could not get the file attachment to work within this post) The symptom is the Frequency Response does not get any data that can be seen...
    In the end I simply want to put a REAL UUT in place of the FIR filter. This would turn the VI into an equi
    v of a $30,000 spectrum analyzer! Sooooo cool!
    Any help would be greatly appreciated. My e-mail is [email protected]
    Thanks,
    Dave

    Dave;
    I'm not quite sure if I understood your application, but by my understanding you want to replace one of the Filter VIs by a VI that does data acquisition from a real external device.
    The first thing you might want to double check is the data acquisition VI by itself. Set up the system with the external device and with the data acquisition VI only. Make sure the VI is acquiring data as expected.
    After that done, make sure that the data acquisition VI output is outputing the same data type that is expected at the output of the IIR Filter.vi.
    I believe that either one of the previous issues might be the answer.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • How do I set up a swept sine vi with multiple response channels?

    I'm using a Compact PXI, the PXI-1002. I'm trying to setup a swept sine program that can acquire more than one response channel simultaneously. Is there an easy way to do this? or do I have to modify the SVT swept sine vi's to accommodate acquiring more channels?
    - Adam Cissell

    Welcome to the discussions, CassC.
    You may need to re-post in the pre-Tiger mail forum.
    But what I THINK you need to do is use your Address Book, and make a group. Add to the group (by selecting, dragging and dropping) the contacts you need in the distribution list. Now in Mail use the name of the group in the To: or Cc: or Bcc: field to send them all mail.
    AK

  • Getting Started with Swept Sine (DAQmx) Multiple Response Signals

    Hi,
    I've been using the modified version of the Getting started with swept sine.vi for multiple response signals
    https://decibel.ni.com/content/docs/DOC-24474. Program fully suitable.
    However, I am facing with three issues :
    1) The edits are highly non user friendly (horrible for 6 multi-channel already), and quite long to perform.
    2) Would there be a way using for loops to have a more compact and flexible way to use FRF? (Calling 6 times the same program in a similar structure does not quite seem like a smart move yet I'm relatively novice in LabVIEW).
    3) Be able to set the number of channels somewhere in the software, and automatically have the software to be able to cope with this? (aka if 20 multichannels are needed, no need to modify the code?)
    It's probably going to be a lot of work to get there, all I'm asking for you guys is to point me in the right direction and suggestions,
    Cheers,
    Kentmey
    Kentmey

    duplicate post, continue here…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Frequency response of real analog filter using mydaq

    Hello!
    I am trying to find the frequency response of a analog filter using the NI myDAQ.  There are several examples of this in Labview, but they are usually analyzing digital filters, not real world filters.  There is one example, see attached vi, that simulates measuring a realworld signal using a simulated frequency generator and a simulated multimeter.  I believe that this could be done for real using the mydaq.
    Can someone please help me convert this VI to run off of the mydaq?
    Thanks!
    Attachments:
    Frequency Response.vi ‏21 KB

    Thank you Kyle, this is exactly what I was looking for.  I searched the examples that came with labview 2010, the signal processing module, the 8.6 DSP module and the signal anaysis toolkit, but I had not yet installed the elvis cd so I didn't run across these VIs.  Thank you once again!

  • Make frequency response analyser using frequency generator and counter

    Hello
    Can we make a frequency response analyser using a Frequency generator and frequency counter?
    How to add modulation with it? Modulation frequency is to be varied as per the input to given to the carrier!
    The outputs are Frequency, magnitude, and the phase as like solartron FRA.
    somebody have an Idea for this
    awaiting for the solution 
    thank you 
    "Thanks with regards "
    by
    ..........Gireesh..........

    Hello Gireesh,
    You can use a function generator to generate frequencies and use the modulation tollkit and other tools availabe with LabVIEW to do the modulation part . Or you can use the analog output ports on the daq card to generate different frequency signals for the same purpose .This should pretty much serve your purpose.
    http://zone.ni.com/devzone/cda/epd/p/id/5646
    http://digital.ni.com/manuals.nsf/websearch/AF3615F31CE9656C862576070020B8F7

  • Frequency response - sound and vibration

    Hi,
    I need to find the frequency response of the DUT. I am using the NI example from sound and vibration toolkit to do
    so (LabVIEW 8.5\examples\Sound and Vibration\Getting Started\SVXMPL_Getting Started with Swept Sine (DAQmx).vi) now my problem is
    to tabulate the phase difference between the stimulus and response when i do it i get constant values. Even though i dont give any response 
    signal to the channel i get the wave same as stimulus, is it suppose to be like that !!!!!!!!!! I will attach my vi so that it gives the idea where 
    i am measuring the phase difference pls check it and help me with this.....thank you in advance.
    Attachments:
    DAQ Freq resp (req)_trial.vi ‏121 KB

    What is the DAQ card you are using for executing this Frequency Response?
    This DAQ error is related to the output frequency of your signal higher than the possible output rate of the card. Basically, you are trying to update at a rate higher than the capability of the card.
    For doing Frequency response, generally you need to have a NI DSA card (446x/447x/449x) with one Analog output and two analog inputs (minimum). Generate the swept sine signal from the Analog output channel, give this signal as input to your DUT and also to one of the Analog input channel. This input to your Analog input channel will act as your Reference signal. Then the response signal from your DUT, connect it to another Analog input channel. You would get a very good response results.
    The reason why you need to have a DSA board is that, for doing Frequency response, we need to acquire both high frequency and low frequency components without much loss. This is possible only if your DAQ board has a higher dB value (in the range of >110dB) which is present only in DSA boards.
    I have completed a Frequency Response Analysis just a week back with the same example programs. So there wont be any problem with that vi.
    Regards,
    Sundar Ganesh

  • Microphone frequency response function

    Hi all,
    I am trying to do an impact test with 3 types of sensors to investigate surface properties of a material.
    The first sensor is the sensor in the modal hammer.
    The second sensor is a geophone , whilst the last sensor is an air-coupled sensor in the form of a microphone.
    Aside from the microphone which is directly connected to the laptop by USB, the instrumented hammer and the geophone is connected to the NI 9233 which is connected to the NI USB-9162 which finally connects to the laptop.
    This hardware doesn't support analog triggering therefore software triggering is used.
    I am using a vi example from http://www.ni.com/example/28438/en/ 
    I have successfuly setup the LabVIEW VI to read the raw data coming in from all the sensors and to obtain the frequency response of the geophone due to stimulus signal created by the impact hammer.
    I have tried to obtain the frequency response of the microphone due to the modal hammer however no results show up in the graph for the frequency response of the microphone.
    My question is this, what is going on and how do I fix this so that I may obtain the frequency response of the microphone?
    I have attached my vi for your consideration.
    Solved!
    Go to Solution.
    Attachments:
    Y2014M01D28 IRnMicFRFRecAll .vi ‏190 KB

    I cannot fix your VI because I do not have DAQmx or the SVFA toolkit. What I have attached is a simulation which shows some of the concepts.
    The left side simulates acquisition of two channels (hammer and geophone) via the DAQ device and one channel of sound (microphone).  Don't worry too much about the details. I just threw this together quickly. The hammer signal is a square pulse, the geophone signal is one cycle of a sine wave with noise, and the microphone signal is one cycle of a triangle wave plus noise. Each of the pulses is dleayed from the start of the acquisition by different amounts to represent the trasmission delays of the sound and vibration.  The values chosen are arbitrary and do not simulate any physics.
    I used the sampling rate, block size, and duration controls from your VI, so the numbers of samples and the sampling rates should be the defaults from your VI. The three graphs one the left show the three signals as generated. Note that the Microphone graph has X-axis autoscaling turned off. Also the data is all in waveforms or arrays. I avoid the use of the Dynamic Data Type produced by Express VIs because it effectively obscures the data structure.
    The right side shows one way to do the triggering. I used Basic Trigger Level Detection.vi from the Waveform Monitoring palette and the Get Waveform Subset.vi from the Waveform palette. Note that there are separate trigger VIs for the DAQ channels and the sound channel. Because they are not started at the exact same time and they do not have the same dt (= 1/sample rate), the waveforms cannot be combined to use a single trigger. The geophone signal is synchronized with the hammer signal so one trigger from the hammer can be used to get both subsets.
    Note that with the default delays the microphone pulse occurs 30 ms after the geophone pulse but in the subsets it occurs about 4 ms before the geophone. This is due to the independent triggering.
    Since you do not have a common signal or trigger for both devices (DAQ and sound), you cannot know exactly what the timing relationship is between them. On every run the differences in the start times will vary. So you will need to do some kind of calibration to determine the time delays.  I am thinking of some kind of periodic stimulus which will produce several pulses to both the geophone and microphone. The first pulses will have indeterminate delays but subsequent pulses should have reproducible delays. The relative spacing and directions during the calibration runs should be the same as the hammer position for the real experiment.
    Lynn
    Attachments:
    Sound and hammer sim.vi ‏28 KB

  • Flat Frequency Response

    I probably shouldn't have to be asking this question since I charge people for my obviously amateurish recording abilities but it's one that I've never had explained to me and one I need to know the answer to......
    Let me set the question up this way:
    When you get in the car and pop in a professionly produced cd, most people crank the treble control up to 6-10 (on a scale of 10) and the bass up to (4-10) depending on the factory speakers and type of material and whether or not they care what their music sounds like. When you get home and you're listening to the much higher end home stereo still listening to that professionaly produced album, you still reach for those treble and bass knobs and crank them up several notches or if you have a graphic eq you tweak out a smiley face .
    There's so much emphasis in the recording world about getting a flat frequency response out of your room with absorbers and bass traps and spreading around the reflections with deflectors, etc...etc..etc..., that we spend thousands of dollars on this stuff and some measuring software to make sure that it's flat. Then we use that flat response to produce music that sounds great and expect that to translate to those cd players and home stereo systems.
    (I'll additonally preface my question by saying that I've had no problems getting my music to translate from my home studio to any other playback system, but I'm a little confused about what's going on.)
    Now finally my question(s), when we reach for those treble and bass knobs on our car and home playback systems, are we really just trying to make up for the lack of bass and top end in those systems so that we too can achieve a flat frequency response and make the music sound good on whatever system?     or
    Do we as listeners actually prefer the smiley face frequency response in music and are we taking a cd that itself has a flat frequncy response and making a smiley face out of it so that it sounds good to our ears? (Please don't give me a material/genre answer.)
    The reason I ask is because I have to put a graphic eq on my Truth 2031A monitors to make the professional stuff sound good through them, and then I in turn mix my music to sound the same for whatever material/genre of course. (I'm not really interested in any monitor bashers or I would've asked this over at Gearslutz.)
    So again rephrased...Do the masses think music sounds good when it has a flat frequency response or the smiley face and if it's the lattter of those, how are we supposed to achieve that when our home studio setup is producing a flat frequency response, do we tune our monitors with eqs like me?
    Additonaly I understand that when were talking about flat frequency responses in rooms we're talking about throwing sine waves through a system and ranging their frequencies, measuring them out so that we can detect any over emphasis/deficiencies in the room so maybe this question is a little more towards monitor tuning.

    If you look up Fletcher and Munson in Google, you might begin to get a bit of the start of an idea of why this isn't quite as straightforward as it seems.... and I'm not sure that I can give you a complete answer either, although I can give you a few connected but slightly random things to ponder, wearing my acoustician's hat:
    The fundamental problem is that when things are quieter (and less distorted, incidentally) our ears get more sensitive to the midrange frequencies, and if we listen to music that way, it invariably sounds as though the bass and treble are out of balance. In cars it's slightly different though; the frequency response of whatever's in there generally tends to be anything but flat - and often over-emphasises the midrange anyway. Treble tends to get absorbed very easily in upholstered cars, and since most car speakers don't have anything like acceptable tweeters in as a rule, it's not surprising that people want to increase the treble. As for the bass - well I'm always turning that down personally, but I know what you mean in principle!
    If by a 'commercial' CD you mean one where the vocal is prominent, then yes I can easily imagine why you might as a matter of course want to increase the response at the extremes - it makes sense if you think about it. The mid-range vocal is prominent and probably compressed, so its average level is louder than the backing - this helps it to stand out. But also it distorts the overall time-based response - the backing may well be balanced so it's okay on its own, but that doesn't always translate if you have the wrong vocal settings applied, or at a minimum, applied unsympathetically. And some voices make this significantly worse; for instance Sealion Dying (AKA Celine Dion) makes the most appalling racket in the midrange, and you'd definitely need less of that!
    So really I'd say that it's not a Bass/Treble issue, but a midrange one. If you look at commercial CDs in general, you tend to find that the energy distribution is pretty even over the whole audio band, which implies that it falls off at 6dB/octave if you look at it in Audition (this is an energy/Hz thing), but in reality most CDs these days are mixed a little brighter than that - more like a -3dB/octave slope down from about 1kHz, and that's partly to compensate for a lot of things - some of which are cars... You do have to watch out for the distortion issue though - most people don't realise, but you are able to tolerate rather higher levels of non-distorted sound than anything with significant distortion levels in it, and if that distortion is in the midrange, then you'll want it quieter anyway. So decent, over-rated under-run PA systems always sound cleaner and louder but you should beware - they can damage your ears just as much, if not more.
    Do car interiors themselves increase the chances of midrange boost occurring?  I think it's a pretty safe bet that they do, as a rule, simply because of the size of them, and the treble problem I already mentioned. And if you are trying to compensate for too much midrange, then the rest follows. Most domestic replay systems these days seem to be midrange heavy to me as well - I haven't heard anything cheap recently that had anything like a flattish response - and they really don't suit the rooms they are in either.
    If you want to listen to material as it really should be, then you need to experience it live first, I'd say, and then do a direct comparison with what you can hear in your monitors. I'm fortunate - I can do this quite regularly with a variety of material. Do I tend to leave things as flat as they are recorded? Well, it depends on what it is. If it's in any way classical, then sometimes I look carefully at the bass balance, but generally I leave the rest alone. Everything else these days I just get to sound good - and that can mean all sorts of tweaks, depending on all sorts of things. More and more though, I've come to the conclusion that too much midrange isn't necessarily a good thing - but that's mainly because of the general lack of good reproduction equipment around these days.
    As for monitors and flatness - well that's not really an issue for most people, compared to getting their listening environment correct. If you have a pair of cheap monitors in a good room, the chances are that the results will sound better than an expensive pair in an uncorrected room - despite what all the monitor freaks on gearslutz might say. These days, even the cheaper ones can sound quite respectable. But flatness isn't an issue with monitors really - a decent impulse response, and low distortion are far more important. Chances are that if a manufacturer has got this right, the monitor is going to be suitably 'revealing' anyway - which is what a monitor is supposed to do.
    The one thing you do not do though, is EQ the feed to your monitors - that went out of fashion almost as soon as it came in - fortunately. You fix the room so that it's more truthful. If you EQ the monitor feed it will inevitably only sound good in one place in the room, and that's no use to man nor beast. The only decent things that proper room correction systems can do is equalise the immediate time response to take account of what's actually between the monitors and you - which if done properly can improve stereo imaging no end.
    So answers? Well not really. But at least I've explained a few (but not all) of the issues.

  • Loudspeaker Frequency Response

    Hi all! I'm making a program to measure the frequency response of a loudspeaker. I'll be using a sweep to test the loudspeaker. 
    Particularly i would like the program to be like this, which is real time. How can i implement this in LabVIEW. This is the screenshot
    Details about the plot.
    First graph:
    Shows a plot in real-time of a frequency sweep with a constant sine sweep amplitude of 1 V. When sweep is started, the graph shows a plot of FFT moving from left to right, with peak of FFT at maximum amplitude of 1 at corresponding frequency of the sweep.
    Second graph:
    Shows the plot of the Sound Pressure Level in dB versus freqeuncy.
    Please refer to the picture and video link below.
    https://www.youtube.com/watch?v=sKC3ioWXG38, skip to 4:10

    Assuming your idea is to sweep a frequency into an amplifier connected to the loudspeaker, and measure the frequency response with a microphone:
    You need to monitor the signal at the loudspeaker terminals to account for any non-linearity's in the signal generator and amplifier.
    You need to know the frequency response of the microphone, this is difficult, and that is why calibrated microphones are expensive.
    You need an anechoic chamber so that the results are not affected by any room resonances.
    Your sound level plot is in dB (A). My understanding of the A weighting is so that the human perceived loudness is constant across the audio frequency range. If you are concerned about loudspeaker performance, is it worth discarding the complexity of this additional frequency response curve?
    This will be a difficult project. Please let us know how you get on.

  • TS-11 Frequency Response At 1/8" Jack

    Hi,
    I tried to play back sound from my new Pavilion TS-11-e100sr using 1/8" jack. The sound was audibly equalized for laptop speakers or maybe earphones and was terrible when it played back through outer sound system. I have measured output voltage at 1/8" jack playing back generated sine waveforms of constant level. The result is shown at the picture attached. As you see, there is an enormous 6dB boost down 100Hz and -3dB cut at mid range around 300-400Hz. At high frequencies there is also progressive 3dB boost up to 16kHz. I tried to find where I can switch off this EQ but I couldn't. Can you please instruct me what should I do to obtain flat frequency response at the output?
    This question was solved.
    View Solution.

    I myself found a solution. I've replaced two Realtec drivers with Microsoft and this gives  flat response close to AC'97 specs.

  • Frequency Response (step response method)

      Hi Guys,   I wish to use this method (this appears as an example vi) for determining the freq response of my system, with my input signal (step response : square wave) I will first need to "derive" the impulse response. Can anyone explain what "derive" means in this occasion. In the example it uses a library call but I need more detail.                                                                                                             Thanks ,ds1
    Solved!
    Go to Solution.

    If you are trying to obtain a frequency response of a system, I strongly recommend to look into the following toolkit:
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/13853
    Here is the manual:
    http://zone.ni.com/reference/en-XX/help/372458A-01/
    Here are some tutorials:
    http://zone.ni.com/devzone/cda/tut/p/id/4170
    http://zone.ni.com/devzone/cda/tut/p/id/5536
    http://zone.ni.com/devzone/cda/epd/p/id/5162
    Hope this helps
    Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

Maybe you are looking for