why FFT result and IFFT result has diffrent in very small value? how to avoid this to increase precission?
이전 댓글 표시
I read from the book that IFFT from FFT result as ifft(ftt(signal)) wil give us the original signal. I try to substract both of them, but i get very small difference of both of them. Does it mean my coding is not corect or limitation in precission calculation by matlab (caused by rounded maybe).
here I provide my code, please help me to evaluate and show if there is a mistake that i make
clc
clear
t=0:0.01:2;
n=length(t);
srate=100; %sampling rate
nyq=srate/2;
data=5*sin(2*pi*2*t)+3*sin(2*pi*10*t);
%dataX=fft(data(:,2))/n;
hz=linspace(0,nyq,floor(n/2)+1);
dataX=fft(data)/n;
recon_data=ifft(dataX)*n;
figure(7), clf
subplot(411),plot(t,data)
subplot(412),plot(hz,2*abs(dataX(1:length(hz))),'-r')
xlim([0 15]), xticks(1:1:15)
subplot(413),plot(t,data,'-b',t,real(recon_data),'--r',linewidth=2)
subplot(414),plot(t,real(recon_data)-data)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 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!
