This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
DSP/TP2/DiogoEliseu_TP2_2.m

27 lines
449 B
Matlab

%% Exercício 2
N = (0:15);
x1 = ones(1,16);
x2 = cos(3*pi.*N./8);
DFT1 = fft(x1, 16);
DTFT1 = fft(x1, 1024);
DFT2 = fft(x2, 16);
DTFT2 = fft(x2, 1024);
subplot(2,1,1)
stem(x2)
xlabel('n'), ylabel('Amplitude'), title('Sinal x2')
subplot(2,1,2)
hold on
stem(X(16), abs(DFT2), "LineStyle", "none")
plot(X(1024), abs(DTFT2))
xlabel('\omega/2\pi'), ylabel('Modulo'), title('DFT / DTFT de x2')
hold off
function f = X(N)
f = 0:(1/N):(1 - 1/N);
end