From eff6c9d24eab1172060901f9a8d61f98ac5204f4 Mon Sep 17 00:00:00 2001 From: rainydaysavings Date: Thu, 12 Nov 2020 14:46:51 +0000 Subject: [PATCH] [2] Ex1 and 2 terminated. --- TP2/DiogoEliseu_TP2_1.m | 12 ++++++++++++ TP2/DiogoEliseu_TP2_2.m | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 TP2/DiogoEliseu_TP2_1.m create mode 100644 TP2/DiogoEliseu_TP2_2.m diff --git a/TP2/DiogoEliseu_TP2_1.m b/TP2/DiogoEliseu_TP2_1.m new file mode 100644 index 0000000..22bdeb5 --- /dev/null +++ b/TP2/DiogoEliseu_TP2_1.m @@ -0,0 +1,12 @@ +%% ExercĂ­cio 1 + +p = [1.8, 0.5, -0.3]; +d = [1, 0.5]; +w = 0:(4*pi/1023):2*pi; +y2a = freqz(p, d, w); +X = freqz(p, d, w); + +subplot(2,1,1),plot(w, abs(X)) +xlabel('w'),title('Magnitude') +subplot(2,1,2),plot(w, angle(X)) +xlabel('w'),title('Phase') \ No newline at end of file diff --git a/TP2/DiogoEliseu_TP2_2.m b/TP2/DiogoEliseu_TP2_2.m new file mode 100644 index 0000000..352a413 --- /dev/null +++ b/TP2/DiogoEliseu_TP2_2.m @@ -0,0 +1,19 @@ +%% ExercĂ­cio 2 + +w1 = (0:15) * 2 * pi / 16; +w2 = (0:1023) * 2 * pi / 1024; +x1 = ones(1,16); +x2 = cos(3 * pi * (0:15) / 8); + +DFT1 = fft(x1); +DTFT1 = fft(x1, 1024); + +DFT2 = fft(x2); +DTFT2 = fft(x2, 1024); + +subplot(2,1,1) +plot(w1, abs(DFT1), w2, abs(DTFT1)) +xlabel('cenas'), ylabel('Modulo'), title('DFT / DTFT de x1') +subplot(2,1,2) +plot(w1, abs(DFT2), w2, abs(DTFT2)) +xlabel('cenas'), ylabel('Modulo'), title('DFT / DTFT de x2') \ No newline at end of file