02-01-2009 02:17 PM
Hello...
I compared array values.
I was comparing: values of matlab after conjugate, with values of labview without conjugation. But now I removed the conjugation of the matlab macro and I am comparing right after specgram function, and the results are still different.
What I made:
- loaded data in matlab (load_in_matlab.txt) and run the macro;
- double clicked on the matrix created by matlab with the specgram (Sig1_results) results;
- into number format I selected longG and verified the values;
- to avoid differences in the interpolation, I saved the interpolated series generated by the macro of matlab (Sig1_interpolated);
- this interpolated series was loaded into labview code (load_in_labview.txt).
Attached is:
- data to be loaded into matlab;
- data to be loaded into labview;
- matlab routine;
- labview routine.
The matlab commands are:
load load_in_matlab.txt
[Sig1_results, Sig2_results, Sig1_interpolated, Sig2_interpolated, x]=macro(load_in_matlab);
save load_in_labview.txt Sig1_interpolated -ascii
clear
exit
I am getting crazy with this problem. Thanks for any advice and help.
Dan07
02-06-2009 05:25 PM - edited 02-06-2009 05:30 PM
Hello...
Sorry for too many questions, I promise that this is the last one
This code of matlab :
[B,F,T]=specgram(pi,512,10,hanning(512),256);
B=B.*conj(B);
Does the Labview routine represented in the image attached perform the same of the Matlab code?
Thanks
Dan07
02-18-2009 08:16 AM
Hello Dan,
Sorry i have no time to spend on your project at the moment
but to answer your question yes it's the same
try to make test signals to compare the two code ex pure sinus and composed knowed signals
To make tests between matlab and labview code, have a look on programmation->structure->mathscript node
this mayb be allow you to reuse parts of your matlab code like specgram function
@+
Tinnitus
02-18-2009 06:14 PM
hello,
sorry i read too fast i thought you were only talking about z*
but to the rest of the post is still available,
1) have a look on mathscript 2) make test with kowned signals
@+
tinnitus
10-05-2009 10:29 AM
Hello,
I have a problem with STFT. A labview program is attached. I want to vary the window size (say to change the time and frequency resolution, where can I do it in the program? If you intend to modify my program, pls down grade to 7.1. Thanks.
Wallace
10-06-2009 09:03 AM
Hello!
I want to speak more explicitly what my problem is. Actually my problem is how to control the size of the short time window (say, from 2, 4, 8, 16 points) running accross the whole signal step by step, and how many points (after zero pedding) are used to generate the FFT plots.
The LabVIEW tutorial says for time interval in STFT spectrogram says '....specifies the time interval to observe the input signal in the joint time-frequency domain. The value of time interval must be greater than zero. The default value is -1 and specifies that this VI adjusts the time interval automatically so that the joint time-frequency representation has no more than 512 time bins. time interval is in the normalized unit, number of samples. The number of time points in the joint time-frequency representation equals floor((signal length – 1)/time interval) + 1'
When I used the default values -1 in both time interval and no. of freq bins in the STFT vi, it looks to me that the short time window should be 512 (confirmed after a backward calcaution, i.e. reciprocal of freq resolution x time resolution), but it seems to be that 512 is too big for a short time window. So is zero padding used? If so, what is the number of time bins before zero padding?
It looks amazing to me because simply two magic default numbers -1 solve the most fundamental problem in STFT, i.e. A wide window gives better frequency resolution but poor time resolution; and a narrower window gives good time resolution but poor frequency resolution. However, this fundamental statement is true when I vary the number of frequency bin and time interval connecting the STFT vi to other values (say, any +ve integer other than -1). So what's behind the -1? I am confused here. Am I wrong in any point?
Thanks.
Wallace