From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Different results between psd_welch in labview and pwelch in matlab

Hi,

 

I use the following code. Both MathScript and TSA return 129 data of PSD.

 

For the Simulate Signal express VI, the settings are

 

Frequency: 10.1 Hz

Amplitude: 1

Phase: 0

Offset: 0

Sampling Rage: 10000 Hz

Number of Samples: 1000 (Auo)

 

pwelch.png

0 Kudos
Message 11 of 17
(4,915 Views)

Thank ttrr, I used waveform chart to show the psd and gave wrong value

0 Kudos
Message 12 of 17
(4,905 Views)

I came across the same problem and still cannot figure out why the pwelch function gives a different result with labview TSA welch function. Interestingly, I found the FFT psd also has a very difference with TSA welch function. I think the two psd calculation methods though differ from each other but should have results similar with each other. Ohterwise, which function should we trust? 

 

Regards

Lwx

0 Kudos
Message 13 of 17
(4,876 Views)

Hi,

 

 I am doing project on labview.

and i am working on signal processing welch window.

so can you please send me the vi what you have done, it may help me a lot.

 

0 Kudos
Message 14 of 17
(4,704 Views)

Hi sujith,

 

you have been asking this question several times before. [1] [2] [3]

 

You have been told not to create duplicate post for the very same topic - that includes not to hijack older threads...

You were asked questions which you haven't answered until now...

 

Why don't you just recreate the snippets shown in this thread?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 17
(4,697 Views)

psd_welch is not the only function which returns different results from those of Matlab. Just lately I had the same trouble using 'contourc' function. MathScript 'contourc' gives a slightly different contour than the one from Matlab. I was told they were both right, because the results were so close.

 

Here is the link to that post http://forums.ni.com/t5/LabVIEW/Results-from-contourc-in-MathScript-not-match/td-p/2436236

 

Combined with this post, it seems that MathScript implementation of m code has more issues than I previously thought. 

 

 

0 Kudos
Message 16 of 17
(4,601 Views)

@ MengHuiHanTang: If you re-read the last two posts by ttr and pem you'll note that both the MathScript node and TSA did return 129 data elements as well. The difference was due to using a waveform chart rather than a graph.   

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 17 of 17
(4,584 Views)