Professional Documents
Culture Documents
Final Project Advanced Math
Final Project Advanced Math
N = 8;
n=0:N-1;
x = (0.9).^n; % simply boxcar signal clf
subplot(2,1,1);
stem(n, x)
xlabel ('n')
ylabel ('x[n]')
axis([0 N 0 2])
M = 4;
X = fft(x);
middle = X(N/2+1)/2;
Y = M * [X(1:N/2) middle zeros(1, (M-1)*N-1) middle X(N/2+2:end)];
y = real(ifft(Y));
t = linspace(0, N, N*2*M);
xt = (0.9).^t;
subplot(2,1,2)
plot(0:length(y)-1, y, 'o', t*M, xt, '--')
legend('y[n]', 'x(t)')
xlabel ’n’, ylabel ’y[n]’
axis([0 M*N 0 2])
title ('FFT-based interpolation of x[n]')
hold on
stem(n*M, x, 'filled'),
hold off