02-11-2016 07:17 PM
I'm trying to create a sine wave with sampling frequency that can go above and below the Nyquist frequency. The way I've managed to achieve this so far is by setting up the samples per cycle and amplitude in a for loop, surrounded by a while loop (see the code attached). This means that I have to control the frequency using a time delay in the loop, but for some reason changing the sample rate also changes the ouput frequency.
Can someone help me with this? I want to be able to change the freuqnecy using a time delay and not have it changed by the sample rate as well.
Thanks!
02-11-2016 08:18 PM
@Valsae wrote:I want to be able to change the freuqnecy using a time delay and not have it changed by the sample rate as well.
That is impossible since the delay is your sample rate. If you want to change the frequency, you have to change N.
But you are also going about this the hard way. Look at the Sine Waveform.vi in the Signal Processing->Signal Generation palette. It will do everything you need.
02-11-2016 10:16 PM
Unforunately the Sine Waveform.vi does not satisfy my needs, as it requires that the frequency be less than or equal to half the sampling rate. I need to be able to make frequency more than half the sampling rate, while still being able to control the frequency independently. Is there any way I can execute the code over a fixed amount of time, regardless of the number of data points per cycle? Can I change this fixed time?