필터 지우기
필터 지우기

difference between FFT(X) and FFT(X,N)

조회 수: 1 (최근 30일)
zozo
zozo 2012년 3월 14일
Hello,
I have the following:
clc
clear all
close all
Fs=1000;
T = 1/Fs; % Sample time
L = 1000; % Length of signal
t = (0:L-1)*T;
delta_T=2.345 / 1000; %delay time in SECONDS
% Time vector
x = sin(2*pi*50*t);
w=2*pi*50; %angular freq. component
X=fft(x);
Y=X.*exp(1j *2*pi*([0:L/2 -L/2+1:-1])*L*T*delta_T);
y_1=real(ifft(Y));
y_2 = sin(2*pi*50*(t+delta_T));
%plot signals
stem(y_2-y_1); %<--- negligible
If I do the above process efficiently, by performing 'N' point FFT where 'N' is a power of 2, then what changes should be made in the above code to produce same result?

답변 (1개)

Wayne King
Wayne King 2012년 3월 14일
Are you sure you need to use a power of two for efficiency? At any rate you can get rid of the padding in time domain. And although you won't get the perfect reconstruction you are looking for, the waveforms will be very similar.
Fs=1000;
T = 1/Fs; % Sample time
L = 1000; % Length of signal
t = (0:L-1)*T;
delta_T=2.345 / 1000; %delay time in SECONDS
% Time vector
w=2*pi*50; %angular freq. component
x = sin(2*pi*50*t);
Lprime = 2^nextpow2(length(x));
X=fft(x,Lprime);
Y=X.*exp(1j *2*pi*([0:Lprime/2 -Lprime/2+1:-1])*Lprime*T*delta_T);
y_1=real(ifft(Y));
Now if you plot y_1
plot(y_1)
You'll see the effect of the zero padding from point 1000 to 1024. So just throw away the padding
y_1 = y_1(1:L);
However, you will not obtain the kind of perfect reconstruction you were looking for, but compare y_1 and y_2.
y_2 = sin(2*pi*50*(t+delta_T));
plot(y_1)
hold on;
plot(y_2,'k');
  댓글 수: 1
zozo
zozo 2012년 3월 19일
Can someone please explain why this difference is occurring? Is it something to do with wrapping around of circular convolution?

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by