NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
_trent_
Posts: 37
0 Kudos
Accepted Solution

Sinewave

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_

 

Active Participant
D_Biel
Posts: 639
0 Kudos

Re: Sinewave

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
Product Support Engineer
Member
_trent_
Posts: 37
0 Kudos

Re: Sinewave

Thank you so much :smileyhappy:

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page