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!