DATAWRAP
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I've noticed that MATLAB uses datawrap to compute spectra (or spectrum-related quantities) when the user asks for a number NFFT of frequencies that is smaller than the WINDOW-LENGTH/2+1 (if WINDOW-LENGTH is even) rule. Essentially datawrap chuncks the data into smaller segments and then averages the segments together. Am I right? Since I think that this would really be bad for my data: why is it implemented like that? and why is it not documented in the helps? Many thanks in advance, Cesare
1 Kommentar
Honglei Chen
am 28 Mär. 2011
Could you be more specific about where you see this? I don't see why WINDOW-LENGTH/2 is so special. Maybe I'm missing something.
Antworten (4)
Honglei Chen
am 30 Mär. 2011
Hi Cesare,
If I understand your question correctly, your problem is more related to why MATLAB wrap the data, the particular length is just a specific case. I'll try to explain the reason for wrapping the data.
The calculation of signal spectrum, such as periodogram, uses FFT internally, where the length of FFT is denoted as NFFT. In theory, when using FFT, the signal in both time domain and frequency domain are discrete and periodic, where the period is given by NFFT. Hence, if you specify an NFFT that is less than the signal length, it actually introduces the aliasing in the time domain and make the signal (even if its length is N>NFFT) periodic with NFFT. When you take FFT of this sequence, you are working with this aliased sequence. This is what datawrap do for you.
For example, if you have a sequence 1 2 3 4 5, assuming that your period is also 5, you have
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
--------------------------------
... 1 2 3 4 5 ...
i.e., your original series. Now assume you have a period of 3, then it looks like
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
------------------------
... 5 7 3 ...
A sequence that is wrapped around and has only a length of 3. Note that
>> datawrap(1:5,3)
ans =
5 7 3
HTH.
0 Kommentare
Cesare
am 28 Feb. 2012
1 Kommentar
Honglei Chen
am 28 Feb. 2012
Your signal may not be periodic to start with. But if you use FFT, it samples the signal in both time and frequency, which in turn makes the signal periodic in both frequency and time, and that's where the circular convolution behavior kicks in.
Zeeshan Salam
am 5 Nov. 2019
how i wrap these two curves?
%define x for both curves
x_ref = 0:0.01:1;
x = 0:0.01:1;
%define the reference curve and the other curve
c_ref = sin(x_ref*2*pi);
y = 0.5+0.5*sin(x*2*pi);
%plot both curves
figure(1)
plot (x_ref,c_ref,'r');
hold on
plot(x,y,'b');
axis([min(x_ref)-1,max(x_ref)+1,min(c_ref)-1,max((c_ref))+1]);
legend('c_{ref}','y')
0 Kommentare
Siehe auch
Kategorien
Mehr zu Parametric Spectral Estimation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!