In: Electrical Engineering
Consider the finite duration signal x(n) = (0.9)ncos(0.1πn) for 0 ≤ n ≤ 31. Using MATLAB:
a.) Plot the signal
b.) Plot the real part of the DFT of x(n), the imaginary part of the DFT of x(n) and the DCT of x(n). All transforms are length N = 32.
%code
clc;
clear all;
for n = 1:32
x(n) = 0.9*(n-1)*cos(0.1*pi*(n-1));
end
%code for part a)
figure()
plot(x);xlabel('time');ylabel('amplitude');title('Input
signal');
%code for part b)
figure()
plot(real(fft(x,32)));xlabel('frequency');ylabel('amplitude');title('Real
part of fft of the signal');
figure()
plot(imag(fft(x,32)));xlabel('frequency');ylabel('amplitude');title('Imaginary
part of fft of the signal');
figure()
plot(dct(x,32));xlabel('frequency');ylabel('amplitude');title('DCT
of the signal');