LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help with pwelch function in Mathscript

I want to use the pwelch function to determine PSD. Here is the snippet of code

 

fs = 1000;
t = 0:1/fs:0.9;
fftsize = 1024;
noise = randn(size(t));
x=exp(1j*2*pi*t*200);
w=(randn(size(t)) + 1j*randn(size(t)))/sqrt(2);
s = x+w;
win = hamming(64);
noverlap = 32;
[Pxx,f] = pwelch(s,win, noverlap, fftsize, fs, 'twosided');

 

This works perfectly fine in Matlab, but crashes in Labview. I've traced the problem to the fact that my input signal is complex. If I make it real-valued, it runs fine. When I use complex numbers I get the following error

 

Error -90046 occurred at Error in function pwelch at line 26.  The input parameters are not in the required format.

 

 

Again, this code works find in Matlab, so if anyone has any insight I would appreciate the help.

 

Bill

 

 

0 Kudos
Message 1 of 3
(3,192 Views)
0 Kudos
Message 2 of 3
(3,186 Views)

After talking with NI, we discovered that the pwelch function only accepts real data, not complex. Hopefully, they will fix this in a future version.

0 Kudos
Message 3 of 3
(3,172 Views)