ifft after one fft
1 次查看(过去 30 天)
显示 更早的评论
Hi all,
i am trying to perform an "ifft" after a "fft" but i have a problem when the number of points for my "fft" has not the same length than my function length.
bellow, you have my test code to try to understand :
%fonction
t=linspace(0,100,1000);
y=0.3*sin(2*pi*10*t)+0.6*sin(2*pi*20*t)+0.9*sin(2*pi*30*t);
%first case : number of pts is same
spectreFFT1=fft(y);
y1=ifft(spectreFFT1);
figure (1);plot(t,y,'ob',t,y1,'r');
%second case : number of pts is different
pts = 2^nextpow2(length(t));
spectreFFT2=fft(y,pts);
y2=ifft(spectreFFT2,length(t));
figure (2);plot(t,y,'b',t,y2,'r');
thanks for your help !!
0 个评论
采纳的回答
Wayne King
2013-4-24
编辑:Wayne King
2013-4-24
The DFT and inverse DFT are mappings from a N-dimensional complex vector space to an N-dimensional complex vector space.
When you change N as you do by padding, then they are different, so you cannot expect the vectors to be the same.
What you can do is this:
spectreFFT2 = fft(y,pts);
y2 = ifft(spectreFFT2);
y2 = y2(1:length(y));
figure (2);plot(t,y,'b',t,y2,'r');
Since padding is just appending zeros, you simply remove the zeros at the end.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!