Hi Morgan,
In this situation with periodic waves, the ftt is divided by L, as you have.
The fft is at heart an operation using complex variables. You can use sines and cosines, multiply amplitudes by 2, except don't multiply X(1) by 2, all that kind of stuff. Some of that is good for plotting purposes. But if you want to get back to the time domain it's far easier to use complex amplitudes and exp( i* ...).
The spacing of the frequency array is Fs/L. Since w = 2*pi*f, the w array is 2pi times the frequency array.
Because of aliasing, frequencies with index > L/2 can be expressed as negative frequencies but that was not done here.
In what follows I changed x_ to y (time domain), X to yf (freq domain) and f to yy (to compare with original y).
Fs = 1000;
T = 1/Fs;
L = 1000;
t = (0:L-1)*T;
delf = Fs/L;
f = (0:L-1)*delf;
w = 2*pi*f;
y = 3*sin(2*pi*4*t)+sin(2*pi*6*t);
yf = fft(y)/L;
yy = zeros(size(y));
for k = 1:L
yy = yy + yf(k)*exp(i*w(k)*t);
end
plot(t,y,t,yy+.2)
댓글 수: 0
댓글을 달려면 로그인하십시오.