ifft after one fft

1 次查看(过去 30 天)
21did21
21did21 2013-4-24
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 !!

采纳的回答

Wayne King
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 CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by