Write your OWN Matlab algorithm without using any builtin Fo
Write your OWN Matlab algorithm (without using any built-in Fourier Transform algorithm of any software) to determine and plot the DFT, specifically the amplitude spectrum in the range 0 lessthanorequalto omega lessthanorequalto 2pi for the following cases: (a) 1 cycle of x(n) = 10cos (2pi5/4n) + cos (2pi17/16n) with 10 zeros padded;
Solution
x = [0 2*3.14];
N = length(x);
X = zeros(4,1)
for k = 0:N-1
for n = 0:N-1
X(n) = 10*cos(2*3.14*5/4*n) + cos(2*3.14*17/16*n)
end
end
t = 0:N-1
subplot(311)
stem(t,x);
xlabel(\'Time (s)\');
ylabel(\'Amplitude\');
title(\'Time domain - Input sequence\')
subplot(312)
stem(t,X)
xlabel(\'Frequency\');
ylabel(\'|X(k)|\');
title(\'Frequency domain - Magnitude response\')
subplot(313)
stem(t,angle(X))
xlabel(\'Frequency\');
ylabel(\'Phase\');
title(\'Frequency domain - Phase response\')
X % to check |X(k)|
angle(X) % to check phase
