DATAWRAP
14 次查看(过去 30 天)
显示 更早的评论
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 个评论
Honglei Chen
2011-3-28
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.
回答(4 个)
Honglei Chen
2011-3-30
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 个评论
Cesare
2012-2-28
1 个评论
Honglei Chen
2012-2-28
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
2019-11-5
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parametric Spectral Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!