Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

SineWave function

In response to one of my questions about SineWave, you stated:

Elton Wells on 7/31/2003 answered:
"Take a look at these two overloads of CNiMath::SineWave:




CNiMath::SineWave(CNiReal64Vector& x, unsigned int samples, double& phase, double amplitude, double freq);

CNiMath::SineWave(CNiReal64Vector& x, double& phase, double amplitude, double freq);



Note that these two overloads take a phase parameter by reference. This parameter specifies the initial phase at function call time and will contain the phase for the next portion of the sine wave at function return time. If you use the same double variable across multiple calls to these overloads of CNiMath::SineWave and if you don't modify the variable between calls, it should give
you a continuous signal across the multiple calls.


- Elton"



Can you explain more about this and type in a sample code? When I tried that in Measurement Studio, they gave me two options:
CNiMath::SineWave(CNiReal64Vector &x, double amplitude)

CNiMath::SineWave(CNiReal64Vector &x, unsigned int samples, double amplitude)

I am using Visual C++ 6 and Measurement Studio.
0 Kudos
Message 1 of 4
(3,336 Views)
Hello

If you refer to the MS 6.0 documentation, you will see that the SineWave function has 4 overloads available. The frequency parameter has units of cycles per sample. You can use this parameter with the # of samples parameter to decide how many cycles of data you want. Suppose you want 4 cycles. You would set frequency to be 0.04 cycles per samples ( or 25 samples/cycle), and set the number of samples to be 100.
If you keep on calling the sinewave function again with the same phase parameter ( like in a timer for example), you will generate s continuous sinewave, since the CNiMath::SineWave function will use that phase information .


I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
Message 2 of 4
(3,336 Views)
Dear Ms. Durrani,

I can still only get the following two functions:
CNiMath::SineWave(CNiReal64Vector &x, double amplitude)

CNiMath::SineWave(CNiReal64Vector &x, unsigned int samples, double amplitude)


I want to be able to get the CNiMath::SineWave(CNiReal64Vector &x, unsigned int samples, double &phase, double amplitude, double freq); How shall I do it? It always give me an error message whenever I try that.
0 Kudos
Message 3 of 4
(3,336 Views)
It sounds like you have the base package of Measurement Studio which only has the two simple sine wave functions. To get the continuous generation functions, you need to either upgrade to the full package or, if you are using Visual Studio .NET, get the preview of the new version of Measurement Studio from the Measurement Studio page on ni.com.

TonyH
Measurement Studio
0 Kudos
Message 4 of 4
(3,336 Views)