01-17-2010 04:05 PM
Hi,
According to the help for the above method (CWDSP.Sinewave) the parameters are as follow:
( n, Amp, f, Phase)
n As Variant - [Input] Number of samples to generate.
Amp As Variant - [Input] Amplitude of the resulting signal.
f As Variant - [Input] Frequency of the resulting signal in normalized units of cycles/sample.
Phase As Variant -[Input/Output] Initial phase in degrees of the generated signal. As output, Phase is the phase of the next portion of the signal. Use this parameter in the next call to this function to simulate a continuous function generator.
Aren't we missing the sampling frequency?
example:
I want to generate the following sinewave --
freq = 1khz
sampling frequency = 10khz
Block size (number of samples) = 1024
Amp = 1
How would you use this function for this signal?
My guess is (but I'm not sure about it...) is: CWDSP.Sinewave (1024, 1, 1/10, 0)
There is an example: 'Power Spectrum'. In that example they don't mention the sampling frequency and the signal is generated as follow:
CWDSP.Sinewave (1024, 1, 1000/1024, 0)
No mentioning of the sampling frequency !?
Thanks
Solved! Go to Solution.
01-18-2010 05:00 PM
Hi Rafi2003,
The reason that this function does not contain any sampling information is because it does not have time information; it is just a series of points. To generate a wave based on a certain sampling frequency, we will need to generate a lower frequency wave to account for the number of poinTestStand we are expecting for every second. In the example you presented, a 1khz wave sampled at 10khz would translate into a .1 hz wave (1000/10000) at a 1 hz sampling rate, so your guess is correct. Once you associate the timing information, you will "speed up"by a factor of 10000, increasing the frequency back to 1khz. Hope this helps to clarify!
01-19-2010 08:18 AM
Hi Al,
Thanks for clarifying things up.
However, I got lost at the second half of your answer.
The 0.1 hz wave is actually is actually the amount of signal per 1 sample point. Correct?
Assuming we have 1024 points array, it translate to 102.4 cycles of the signal. Am I correct?
Thanks
Rafi
01-19-2010 10:40 AM
Hi Rafi,
Both of your assertions are correct. The .1hz frequency with no timing is equivalent to what you would get from hardware sampling a 10khz wave at 1000 S/s; in both cases you would see a cycle of the wave every 10 samples, as you are pointing out.