LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Sinewave

Solved!
Go to solution

Hi,

 

I am trying to generate a sum of sines with Sinewave function and compute its fft to see if i can get back the magnitude of each harmonic. This is aiming at, later, getting a real signal and computing its fft. But for the moment I'm testing the code on virtual signals (square, triangle etc).

However, I fail at plotting the sum of 3 sines. I don"t understand how i can generate a first sine (fundamental) and then sines with a frequency multiple of the fundamental. (f, 3f and 5f). 

 

I tryed this :

 

Sinewave(512,5,1/512,&ph1,sine1);

PlotWaveform(...,...,sine1,512,...,1.0,0.0,0.0,1,...,...,...,1,...);

 

But nothing appears except a constant line.

To sum it up : I think I have understood nothing at all about how the function sinewave works, espacially about the frequency I have to pass.

 

Many thanks if you can help me

 

Regards,

 

 

_trent_

 

0 Kudos
Message 1 of 3
(3,440 Views)
Solution
Accepted by topic author _trent_

Ah. This was one of those simple mistakes that takes forever to find. For the Frequency parameter you have specified "1/512", but since that is integer division, it evaluates to 0. Instead do "1.0/512".

National Instruments
0 Kudos
Message 2 of 3
(3,435 Views)

Thank you so much 🙂

0 Kudos
Message 3 of 3
(3,425 Views)