LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

user signal simulator

I want to create a function to simulate a sinusoid waveform, modulated by another signal. and then I want to use LabView's FFT to analyse it to see the frequence spectral. How to implement this use labVIEW.
If the signal is pure sinusoid waveform, that's easy. just use VI provided signal simulator. In my case I want to use a C code to generate the signal. Please give me some clue.

Thank you guys
0 Kudos
Message 1 of 2
(2,860 Views)
CVI includes the ANSI C sin function. The input is in radians.
Use a loop if you want to create a array of data.

#define PI 3.14159265

//...

int numberSteps = 100;
int amplitude = 1;
int i;
double *sineWave;

sineWave = malloc (sizeof(double) * numberSteps);

for (i=0; i < numberSteps; i++)
sineWave[i] = amplitude * sin(i*2*PI/numberSteps);

The CVI Advanced Analysis Library also includes the following function which does some of the work for you.
int SineWave (int n, double amp, double f, double *phase, double x[]);
Message 2 of 2
(2,850 Views)