필터 지우기
필터 지우기

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.
  댓글 수: 1
21did21
21did21 2013년 4월 24일
thanks for your help, nice !!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Transforms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by