From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

square wave gerneration from harmonics and fundamental

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

 

0 Kudos
Message 1 of 5
(3,211 Views)

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

0 Kudos
Message 2 of 5
(3,189 Views)

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.

 

 

Download All
Message 3 of 5
(3,139 Views)

Hello A

0 Kudos
Message 4 of 5
(3,024 Views)

Autoscale your graphs on the right. Wire a TRUE to the reset terminal of the "sine waveforrm" generators.

0 Kudos
Message 5 of 5
(3,014 Views)