Building a square wave by adding harmonics

Hi,
I'm trying to create a Fourier Series to build a square waveform by adding the harmonics. But, after I implement the functions into the software, there are some errors in the output and i cant get the square wave output.
I've attached the vi and the document containing the expected output from the vi.
Please take a look
Thanks,
Edward
Attachments:
Fourier Series1.vi ‏101 KB
Fourier Series1.doc ‏47 KB

   hi, i can't see the VI cause i've 8.0 and the version of your vi is higher, but i built this little vi I've attatched based on the word's document, maybe it's what you need. Bye.
Paul
Mechatronic engineer
Lima-Perú
Attachments:
fourier.vi ‏20 KB

Similar Messages

  • I need help adding two signal waveforms from a square wave generator using an or gate

    Hey Im working on a square wave pulse signal that can be displayed using an FPGA board. I have two different pulses (signal 1 and 2)  generated from square wave generators on LabVIEW each with equal duty ratios but different phase offsets. I need to add the two pulse signals together to get another signal (signal 3) showing two pulses (from signal 1 and 2). I have tried using an Or gate but that wouldnt work as expected. Please I need some guidance on how to implement this boolean logic, P.S. Im open to any other solutions. Thanks.
    For clarity: Imagine signal 1 = 00001000
                                       signal 2 = 00100000
    I need signal 3 to be             =  00101000, I hope this emphasizes my point.

    The problem is with the third function from the left.  Oops, I forgot, I'm not clairvoyant.  Maybe if you posted your code, we could really tell you if the problem is the third function from the left ...
    Bob Schor

  • 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

  • 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

  • IMac -- Compatible with UPS Square Wave Voltage

    I have been reading of the incompatibility of UPS square wave outputs of UPS devices and the new energy star 4 or 5 computers. The new iMac is energy star-5 compliant. The power supply output of a UPS will not work with new computers.
    Does anyone have any information on this issue?

    I’ve been trying to find the same answers for my 24”, intel,Core 2 Duo extrerme, 2.8GHXZ, iMac (mid 2007) that Apple Engineering says has Active Power Factor Correction power supply.
    All I want from an UPS is decent time to unmount my external H.D., save my working data, and shut down the iMac properly. After the better part of two weeks I believeI have found the answer for my situation. Disclimer: I am not a tech nor experienced in electrical matters but just a guy who hung in there trying to make sense out of many conflicting bits of information. This is not meant to tell you what you should or should not do. Just what I believe I’ve found and what I have done about it
    after talking to lots of tech people. Corrections/updates welcomed!
    1. Apparently, there are some recent models of computers that have an updated power supply commonly called Power Factor Correction power supply (PFC), more specifically called Active Power Factor Correction Power Supply. As I understand it they were previously found mostly in the higher end of computers and not commonly found in the type that the average guy would use. Now Apple Engineering has told me via Apple Care that my 2007 iMac has an Active Power Factor Correction power (akaPFC) supply and that all wide range voltage supplies are PFC. I take that to also mean late model iMacs and most likely Mac Pros have this type of power supply.
    Mine has it and it is a 2007 iMac, I’m not sure when they started using it in iMacs.
    2. So what ? Well, if you tell an UPS mfg. your computer has an Active Power Factor Correction power supply or even if you drop the word “Active” (and use PFC) they will commonly say you need an UPS battery that sends electricity via a Pure Sine Wave to the computer. They are very costly units, easily $500 and up.
    3. What is an Active Power Factor Correction power supply, aka Power Factor Correction supply (PFC)? Paraphrasing and editing a statement from a battery mfg support page: Although a computer power supply draws only a fraction of its full capacity during its steady state (normal) operation, Power Factor Correction (PFC) supplies have the potential to draw their full capacity ( which I assume is the stated watts on the computers data sheet), instantly when passing battery power to the computer’s Power Factor Correction power supply.
    So what? well, the UPS may experience up to 8ms transfer time during this period which is just long enough to remove power from the computer’s Power Factor Correction supply which subjects the UPS to the maximum power draw of computer’s Power Factor Correction supply (PFC). This could result in a potential UPS overload or dropped power load ( computer restart, shut down ) because the UPS does not have the ability to furnish the amount of demanded power (watts).
    4. I solved my problem of what kind and reasonable cost UPS would work with my Intel iMac after talking with APC , local Apple Authorized repair & CyperPower. First I determined the max watts draw of my iMac x 3 ( to allow sufficient excess watts when in an instant max watts demand from the Computer’s Active Power Factor Correction power supply ) and added the max watts draw of my external H.D. and FIOS Router to determine the total UPS watts that would be required to aid in the UPS selection process.
    I purchased a CyberPower UPS model CP1500AVRLCD 900W , which successfully sent Simulated Sine Wave power just fine to my computer’s Active Power Factor Correction power supply when testing it two times. No need for costly Pure Sine Wave UPS. Cyberpower says this unit will work with the iMac but not work with the Mac “Tower” / Mac Pro and I suspect it has to due to the huge difference between them in maximum watts that can be instantly drawn when the Active Power Factor Correction power supply instantly demands the full watts power from the UPS.
    APC UPS model BR 1200 (also a non pure Sine Wave UPS) is recommended by a local Apple Authorized Repair facility (vendor) to his customers as working with the current iMacs.
    I personally think the difference in working and not working is getting the right amount of excess watts in the UPS, can’t think of any other reason it works. I really don’t care as long as it works.

  • Why do i get ringing when i am generating Square Wave using PCI 4461 DSA Card

    Hi,
    when i generate square wave form DSA card PCI 4461 i am getting ringing effect as per my observation of waveform generated in CRO.Can anybody tell me why is this effect seen and how can it be rectified and removed from the signal in LabVIEW.
    Regards,
    Sneha

    The analog outputs on the 4461 (and the analog inputs, for that matter) are band-limited by digital lowpass filters. These low-pass filters have a brick-wall response in the frequency domain, which results in Gibbs-phenomenon ringing in the time domain. See this discussion, among others:
    http://en.wikipedia.org/wiki/Gibbs_phenomenon
    The ringing will be excited whenever there is significant signal power near the abrupt band edge, because the abrupt cutoff will result in signal power being located just below an absence of power in the spectrum. Whenever signal power appears in spectral isolation like that, you can expect ringing in the time domain response. Your square wave consists of a series of harmonics at frequencies below, near, and well beyond the digital filter's cutoff. When the digital filter cuts off the higher harmonics, the ringing is created.
    To prevent the ringing, you must create a waveform mathematically that is bandlimited already. The result will be a square wave with slower rise and fall times, but no ringing.
    Hope this helps,
    Ed

  • Multiplexed Square Wave

    Hy to all
    I'm working on a project where I have to build a sensor. I'm using 8 analogue outputs and 8 analogue inputs. On every output I have to send one square wave impulse positive and negative with various amplitudes. But they have to be multiplexed, that means first the impulse has to be on output 1 and all imputes have to read the data, then the first has to be 0 again and the next output 2 gets started.
    I've written a program and it logically works fine, but as soon as I run it on the FPGA noting happens. It takes 45 min to compile and I don't know what the problem is. I wanted to measure simply the output with an oscilloscope and the is no signal. 
    If you have time can you look at the program and give me some ideas what the problem could be.
    Thanks
    Attachments:
    Vire Mesh 3 (FPGA).vi ‏779 KB

    hello,
    it looks like a timing problem. Here are a few tips:
    1. the output is in the same loop as the input, but the inputs have their own loop afterwards. This means that the output is written a little too infrequently and is therefore not updated. You should probably separate input and output. Also check the calculations at the top to make sure they don't generate values that are out of the ordinary
    2. you can create the square wave in a separate loop and pass its value with a local variable to other places in your code. This is also good to test the output without interference from the inputs.
    3. you really don't need to connect the same wire in parallel to your sequence structure. Just pass it in once and reuse the same wire in every frame. It will make it easier to read.
    Regards,
    Joseph

  • 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.

  • Generate Square Waves to SCXI 1161 Module

    Hello,
    I am a new user to Signal Express and I wanted to use signal express to generate two Square waves which I will ouput to my SCXI 1161 Relays
    Any quick ideas would be appriciated.
    Tim

    Hey there smoothdurban,
    Typically when you want to generate an output signal in SignalExpress you have to first create the analog/digital signal and then generate it. How this is done in SignalExpress is by first adding a step for "Create Analog/Digital Signal" and then adding a step for "Generate Signals". 
    I attached some pictures to help simulate this. The first picture "creategenerateunbound" shows how an unconfigured generate step does not link with the create signal. The second image "creategeneratebound" shows that after you specify the channel for the generate task, the create and generate will wrap up together and the square wave will match with the channel.
    Also, here is some additional information on why you have to first create and then generate and the SignalExpress Help file about creating signals,
    http://digital.ni.com/public.nsf/allkb/94AC3A0662C8388586256F4700721739
    http://zone.ni.com/reference/en-XX/help/371268J-01/expresswb/create_signal/
    Hope this helps!
    Tim A.
    National Instruments
    Attachments:
    creategenerateunbound.PNG ‏8 KB
    creategeneratebind.PNG ‏7 KB

  • Square wave generation phase offset problems using PXI6602

    Hi,
    I am generating 2 signals to use for simunlating an Incremental AB encoder using a PXI6602.
    The signals need to be square wave, 34.133Khz, offset by 90degrees which I am setting by dividing (1/frequency) by 4 and putting the result into the DAQmx Create Channel (CO-Pulse Generation-Frequency).vi initial delay node.
    The resulting signals phase difference however does not consistantly measure 90degrees. At least 1 in 5 runs of the vi has a phase angle issue resulting in a failed test.
    Can anyone suggest a stable fix for this.
    Thanks,
    David

    Thanks John_P1,
    that seems logical and as for the frequency, it's not really critical that it's exactly 34.133Khz as long as it's there abouts.
    I've had a little play with the trigger suggestion using the examples in LabVIEW as reference (Hardware Input and Output>DAQmx>Counter Output) but I'm getting an error as seen in the attached image no matter what I select the trigger source as.
    I am relatively new to LabVIEW program building and have had no formal training as yet so could you possibly look at the attached vi and suggest or impliment the required changes to get this vi working please.
    Thanks.
    David.
     

  • 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 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

  • 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

  • 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

Maybe you are looking for