04-07-2013 01:00 PM - edited 04-07-2013 01:02 PM
Hi
I am completly new to Labview and strugling with the following problem. Sorry if it is a bit basic for this forum but any help would be great.
I am looking to construct an aproximation for a square wave by summing a fundamental and three harmonics. Thr fundamental freq is 1600 and amplitude is 1v
I am woking out the freq and amp of the harmonics by
freq (4/pi) * (1/3 * V), (4/pi) * (1/5 * V), (4/pi) * (1/7 * V)
amp (4/pi) * (3 * freq), (4/pi) * (5 * freq), (4/pi) * (5 * freq)
I am then subing in the values to the two block diagram attached but neither seem to work.
I am looking for a square wave but just getting errors.
Any help would be great
Thanks
D
04-07-2013 05:05 PM
@DaraOL wrote:
I am then subing in the values to the two block diagram attached but neither seem to work.
Please attach the actual VI instead of pictures. We cannot debug pictures.
@DaraOL wrote:
I am looking for a square wave but just getting errors.
If you are getting errors, it typically helps if you tell us the exact error message.
04-11-2013 07:28 PM - edited 08-18-2014 01:25 PM
As a first step, you should make your code scalable. The core computations of all harmonics is the same and only two numbers change, and they can be calculated from the [i] of the harmonic. I don't know why your right code has a component with zero freqeuncy and amplitude. Can you explain? Of course your left code is useless to tell what you are doing, because all configurations are hidden.
Here's a quick draft how to calculate and sum the harmonics for a square wave with an adjustable number of harmonics. You can probably adapt it to your problem.
08-23-2013 12:13 AM
Hello Altenbach
I am trying to do a similar stuff. But in my case i have custom Amplitude and phase for each harmonic.
I have Written the code in a block for your reference. Its a custom signal generated from an inverted plant. Feedforward control. The reference signal is a triangular signal
ref -> G(inverse) -> u-> G(plant)-> y (output)
I am generating the signal u offline by fitting a polynomial on the plant freqency response and using the coefficents of polynomials to calculate amplitude and phase of the system at each harmonic and generating the input u to the plant by summing the harmonics.
I am not getting the output. Could you please suggest what is the problem with the code.
Regards
Sachin
08-23-2013 01:34 AM
Autoscale your graphs on the right. Wire a TRUE to the reset terminal of the "sine waveforrm" generators.