FFT on triangular and square waves.

Hi,
I have been computing FFTs on a some sinusoidal waves and have been doing fine, gett the right Y axis values in the units Vrms^2.  For example a 10V amplitude (20v peak to peak) wave at 100 htz would give a peak at 100 htz and 49Vrms^2 since the RMS value fo 10 is 7 and 7^2 is 49.  Now when I input a Square wave with the same characteristics I no longer get the same scaling instead getting a peak at a higher y value.  With a triangular wave I get peaks at lower values.  Can anyone explain to me why this is happening?
Thanks.
Intern NSWCCD Carderock.

Actually RMS (Root Mean Square) value of periodic signal f(t) is defined as a square root of squared signal averaged over the period T, mathematically:
f_rms = sqrt ( aver (f^2) ),
where aver (f^2) = [integral of f^2 over the period T] / T
It is easy to show that for pure sine wave f(t) = A*sin(2*pi*t / T), f_rms = A / sqrt(2) ~ 0.707*A – this is well-known result anyone can find in almost every textbook. It is not difficult to calculate exact value of f_rms for square and triangular waves. Results are as follows:
f_rms (square) = A, where square wave f(t) = A, if 0<t<c*T and f(t) = -A, if c*T<t<T (here 0<c<1 and c=0.5 for 50% duty cycle wave)
and
f_rms (triangle) = A / srqt(3) ~ 0.577*A, where I assumed triangle wave that raises from 0 to +A over 0 < t <T/4, goes down to –A over T/4 < t < 3T/4 and returns to ZERO in the last quarter of the period T
Parseval’s theorem (http://en.wikipedia.org/wiki/Parseval's_theorem) of Fourier analysis states that energy of periodic signal (=integral of f^2 over the period T) must equal to energy of its Fourier transform ( sum of squared amplitude of all harmonics for periodic signal). That’s why Fourier analysis in Labview is capable of producing signal’s RMS value in addition to its spectrum.
Now, main harmonic of square and triangular waves carries majority of signal energy, but not all of it because of presence of other harmonics. That means that amplitude of main harmonic as reported by Labview will be close to but slightly less than signal’s RMS value. This explains the results you reported in your very first post.

Similar Messages

  • Can I generate sine and square waves with NI PCI-MIO-16XE-50 card??

    Can I generate sine and square waves with NI PCI-MIO-16XE-50 card??
    How Do I generate those signals?

    Hello;
    You certainly can do that. The way to go about that is to use one of the Analog Output channels your board have available.
    If you are using Labview to program the board, you can find good examples at Search Examples->I/O Interfaces->Data Acquisition->Analog Output->Multiple Point (buffered) Analog Output.
    If you are using other Software language to program the board, you can fing examples at C:\Program Files\National Instruments\NI-DAQ\example\VisualC\AO.
    Hope this helps.
    Filipe

  • Generating Triangular and sawtooth waveforms in FPGA

    I need to generate triangular and saw tooth wave form in FPGA and give it to my testing system, But I cannot generate it, there are options for generating sine wave and square wave only.
    I am currently using Compact RIO 9025 with NI9215,9263,9403 modules.
    Pls tell me is that possible to generate those waveforms and if it is possible describe me how to do that.

    Hello,
    There are 2 good documents that will help you get started with this task. There are, of course, many ways you can implement this and the right way will very much depend on your application.
    Periodic Waveform Generation with RIO Enabled Hardware and LabVIEW FPGA
    Triangle Wave Generated PWM
    If you need more to get started, I'd be happy to assist further, but I think these are enough to get you down the right path.
    Cheers!
    TJ G

  • Convert square wave to sinc wave

    Can anyone please show me how to convert square wave to sinc wave?
    Solved!
    Go to Solution.

    Use the wave generator funtions found in palette Signal Processing - Waveform Generation.  There are sine and triangle waveform generating functions there.  You can set the number of samples and sample rate such that it would generate a partial waveform.  Then you use Get Waveform Components to get the Y values, concat the values, then use Build Waveform to build it back to a waveform.  You will get a back to back output.  In the following example, I used a sine and square wave because a sine and triangle were too close in appearance and you could not readily see the effect.
    As Smercurio says, I don't think this is a very good representation of an EKG signal.  That signal has P, QRS, and T waves.  There is no sine wave.  The waves are like triangle waves, so just put DC waveforms (0 amplitude square wave) ahead of and in between triangle waves for P, QRS, and T, followed by DC.
    - tbob
    Inventor of the WORM Global

  • Phase shift of a sine wave and a square wave

    Hi,
    I would like to simply compute the phase shift between a sinusoidal waveform and a square one. Between two sin-s I can compute, but I have no idea how to do that with a square waveform.
    Thanks,
    Ussr123

    Hi there,
    the easiest way is to use the ExpressVIs.
    But you are only allowed to use the ExpressVI "Tone Measurements" if you have enough periods of the square wave, because it computes the phase with FFT.
    An other possibility is to use the spectrum analyser VI as used in the attached exsample.
    Greetz
    Branni
    Attachments:
    Phaseshift_Sqr_Sin.vi ‏89 KB

  • How do you find the frequency of a small sample size and a square wave.

    I am collecting data from ten 12v pulses that are seperated pretty uniformly. The pulses make a square wave. I need to know how to input this small sample size and find it frequency. I need this frequency to be output in a readable file. Im not very knowledgeable in labview so if you try and help me please be very descriptive.
    I know i need some sort of trigger because of uknown wait times before the sensor will be triggored but other than that im pretty lost. Any help would be appreciated.

    What have you tried so far?  What parts are giving you trouble?  Please be as specific as possible. Post the code you have written.
    You ask about frequency measurement and then you are talking about triggering.
    If you always have 10 pulses, just measure the time from the beginning of the first pulse to the beginning of the last pulse.  The frequency is 10/time.
    Break down the problem to smaller parts.  Acquire the data.  Measure the frequency. Save the result to a file.  Get each part working separately, then put them together.
    Lynn 
    Sorry about duplicate post. My internet connection is very slow today.
    Message Edited by johnsold on 05-31-2010 12:05 PM

  • Custom high and low times for square waves

    Hi, is there a way to create a square wave that has an incremental HIGH pulse width and a fixed LOW pulse width?
    Sorry I'm quite new with labview, any help is appreciated, thanks!
    Solved!
    Go to Solution.

    Hi GBPC,
    My name is Jack and I work at National Instruments UK.
    I understand you are trying to output a square wave signal with a fixed low time and variable high time in labVIEW.
    The reply above works great if you want to use the signal internally. Alternatively if you are trying to output the signal with a piece of internal or external Data Acquisition (DAQ) hardware you will want to use LabVIEWs DAQmx Tool palette.
    I have created a quick example below for you to look at that should help you come to a solution. It uses the DAQmx VIs to create and initialize a channel and then runs it in a loop with controls to change the high and low times using a property node.
    Hope this helps
    Jack. W
    Applications Engineer
    National Instruments
    Attachments:
    Variable High Time Pulse Generator.png ‏37 KB

  • How to view different sine waves in an array and make an fft of these and display it in one graph

    How can i cannect the output of my mathscript in the Spectral Measurements VI SIgnal Input. I'm having a problem since the output of the mathscript file "D" is DBL 2D. I dont know how to convert this data type in order to be connected to the signal input of the Spectral Measurements VI. I also want that the waveform graph connected to output of the Spectral Measurements VI, will display the FFT of the three sine waves in one graph.
    Attachments:
    1.JPG ‏32 KB

    Duplicate
    LabVIEW Champion . Do more with less code and in less time .

  • I have transefer function like (1/(s^2+s+​5)) and i have a square wave input , i want to use this transfer function with this input to see the output , how can i do that , with example please.

    i need to know also how to represent this transfer function in labview, try to send me example. answer me at my mail

    "st" wrote:
    > answer me at my mail
    give a valid e-mail first, and your name, we don't like to help anonymous
    people
    > try to send me example.
    how much do you pay ?
    > i have transefer function like (1/(s^2+s+5)) and i have a square wave
    > input , i want to use this transfer function with this input to see
    > the output , how can i do that
    First you have to know what you are doing, like an engineer : you have a
    Laplace, continuous time transfer function but LabView handles discrete
    signals only. Use matlab/simulink if you want to simulate continuous time
    systems easily...
    If you definitely want to use LabView, the first step is to discretize your
    continuous-time transfer function, i.e. decide a sampling rate and convert
    it to a "z transfor
    m". Then you can directly use the "IIR Filter.vi" as I
    said earlier.
    Philippe Guglielmetti - www.dynabits.com me at my mail

  • Where would I find Uniform White Noise.vi, Square Wave.vi, and Sine Wave.vi?

    I am trying to open the Demo Scope.vi that is located in tutorial.llb that comes with the LabView installation. When I try to open Demo Scope.vi,LabView can not find Uniform White Noise.vi, Square Wave.vi, and Sine Wave.vi that are subVIs that Demo Scope.vi is looking?
    Has anyone had similar problems when trying to run Demo Scope.vi through the Getting Started with LabView manual? FYI, I have the LabView Version 6 Base package. Any help on this subject would be greatly appreciated. Thanks in advance.

    This issue also is mentioned in KnowledgeBase 21H8J2R2.
    In LabVIEW 6.1, the Demo Scope VI referenced in the LabVIEW Getting Started manual only uses VIs available in all LabVIEW development systems, including the base package.
    Kelly H
    LabVIEW Documentation
    National Instruments

  • Using pulse width modulated signal (square wave) to control when a signal is turned on or off

    Using pulse width modulated signal (square wave) to control when a signal is turned on or off
    Greetings All
    I'm trying to use a labview created pulse width modulated signal (square wave) to control when a signal is turned on or off.
    Here's my logic and graphic example:
    1) The source wave signal is continuous
    2) Use a PWM (square wave) created in labview to control when the signal is turned on or off
    3) If PWM signal (amplitude) is greater than 0 play signal if PWM is not greater than 0 don't play signal.
    I'm actually using this to step sequence / pulse several separate magnetic coils using my audio card (which has several audio output channels), I have a signal in labview played constantly.  Than compare it to the PWM (square wave) which controls if the signal gets played on each separate channel or not.  That way I can control which coil is on and off and in what sequence they are activated. 
    I couldn't find an edge detection for a square wave created in labview so I tried Limits but that doesn't seem to work unless I change the phase manually and that only goes from 1 to -1.  I'm just trying to compare the PWM (square wave edges) already created by labview / play a signal if the pulse is greater than 0 and it turns off the signal if it's less than 0.
    Should I be doing this another way
    Tia
    Message Edited by sal22 on 08-16-2009 06:09 PM
    Message Edited by sal22 on 08-16-2009 06:10 PM
    Solved!
    Go to Solution.
    Attachments:
    PWM control signal block.png ‏23 KB
    PWM control signal front.png ‏48 KB
    pwm test.vi ‏36 KB

    Greetings,
    I tried it two ways using amplitude and levels and fft spectrum.  The values don't seem to update the way I need them to (basiclly showing a 0 or a 1).   I compare the Y values like you recommended but they don't ever seem to update.
    tia
    Message Edited by sal22 on 08-19-2009 10:05 AM
    Attachments:
    pwm magnitude not updating.png ‏29 KB
    pwm test.vi ‏41 KB

  • How can I output a square wave to control a stepper motor using 7332 controller?

    I have the following system configuration for testing a linear actuator (LA):
    LabView 7.1
    NI FlexMotion 7332 Motion Controller
    NI Flex DMM 4070
    The LA is a stepper motor with Step and Direction of Rotation inputs, as well as some discrete I/O for Power Enable and other functions.
    The LA specification only requires that I send a 50% Duty Cycle square wave signal with frequency less than 300 Hz to it in order to make it step.  The LA has it's own power source.  I only need the 7332 to generate the drive signal and the DOR signal to the LA.  Using some of the example VI's, I can get the LA to work, but I will need to incorporate the functions in to a custom application. 
    How can I weed through the numerous advanced functions the 7332 offers and only generate a DOR signal and a step command at a user-defined frequency.  How do I set up the controller for this?
    Thanks

    Hello,
    All the VIs that you can use to create a pulse train and digital I/O from your motion controller are found in the "Analog & Digital I/O VIs" sub-palette in the "Flex Motion" palette. Use "Load PWM Duty Cycle" and "Configure PWM Output" VIs to create the square wave. Use the "Set I/O Port Direction", "Set I/O Port MOMO", and "Set I/O Port Polarity" VIs to create digital output. I hope you find this information useful. You can learn about the specifics of these VIs and their inputs/outputs in the NI-Motion VI Help.
    Regards,
    Aaron B.
    National Instruments

  • How to generate a high freq square wave on NI-USB 62xx

    Hi,
    I am trying to generate a 50khz square wave with an AO channel on the NI-USB 6212 (rated at 250ks/s AO). I started with the Voltage - Continuous Output.vi example but when i go up toward 50khz square wave (100khz sample rate) the edges of the square wave become rounded. The slew rate for the card is 5V/us and my amplitude is just .5V so i feel like I'm doing something wrong with the task setup.
    I also tried setting continuous samples using the onboard clock for a source and then writing an array [1,-1] but that fails at anything higher than ~8khz. 
    What's the most efficienct/correct way to set up a task like this? Any help appreciated. Thanks.
    Matt

    Hello Matt,
    Right now, I think that shape of the signal that is being output is being controlled by the load on the AO. 
    If there is a very large impedance load attached between AO and ground, the RC time constant of the circuit is going to be very high.  This will result in a large amount of time required to charge and dissipate the voltage.  By increasing the frequency, the amount of time allotted for this is being reduced.  Potentially resulting in the waveform you are seeing.
    Can you please upload a picture of your waveform?
    Can you please try to reduce the load on the AO?  This can be done by disconnecting the current load and attaching a small resistor (50 Ohms should be good).  Does this result in the correct waveform?
    Regards,
    Thomas C.
    Applications Engineer
    National Instruments

  • How to generate multiple digital outputs (square waves delayed) at 50 kHz?

    I would like to generate 3 digital outputs like the picture attached at 50 kHz. Using the "digital pattern generator (marching values).vi", I can generate 3 digital square wave but without the delay time. How can I do that?
    I'm using the card PCI 6034E.
    Thank you
    Attachments:
    digital outputs delayed.png ‏8 KB

    Hi,
    the digital pattern generator (marching values) only shifts the binary value of the first signal and sample to the next signal/sample.
    Have you tried generating your waveforms via build waveform and use t0 terminal to change the lead delay?
    In general, this DAQmx example could be helpful which you can modify to your needs.
    DAQmx Write Digital Channel- External Clock: https://decibel.ni.com/content/docs/DOC-11142
    Regards,
    Thomas

  • Converting square wave to double

    I am trying to pass to square wave signal into math script.  I am assumeing that i have to convert the signal into a double.  Is this possible?  If so how could I convert this signal so it can be passed into math script?
    Thanks,
    Leif

    Which data type does your square wave signal has? If it is a waveform you can get the value as an array of double with the Get Waveform Components primitve.
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

Maybe you are looking for

  • I am getting an Exception While Deploying ear file in JBOSS

    Problem is in code not able to identify: Here I am posting the 4 files that I have used, please help me: 1st File: package test.session; import javax.ejb.Remote; @Remote public interface MyTestSession {      public java.lang.String SayHello() throws

  • Best of the Month – June '14

    June and July are World Cup months across the globe. That means a bit less online traffic and a lot more soccer — or futbol, as it is known in most countries. Although this is the English-language HP Support Forum, June offered daily reminders of jus

  • How to connect any scanner and cash draw box in retail outlets

    we have JHS 10g oem copy.how can connect with barcode scanner and cash draw box, print invoice over the JHS? is it any pre defined ADF application available in Oracle for retails?

  • Firefox will not load Facebook as of today. It says, Please try again later.

    I have not been able to get into Facebook using Firefox all day today. It keeps saying Please try again later. I have done nothing different, it just started happening.

  • PS CS3 - any action make 100% CPU and very choppy

    Hello! I have PS CS3 on Win XP SP2, 2 GB RAM, nVidia geForce 8500GT with updated drivers. Until 2 days ago everything was perfect (smooth movement and action in PS CS3). Suddenly every move I make (draw a simple line, move or resize window, painting