From 1550091fd019f740f4d3a4007385194e11d8365a Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Wed, 21 Oct 2020 00:28:09 +0000 Subject: [PATCH] ex11: terminated. --- TP1b/DiogoEliseuHugo_TP2_11.m | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 TP1b/DiogoEliseuHugo_TP2_11.m diff --git a/TP1b/DiogoEliseuHugo_TP2_11.m b/TP1b/DiogoEliseuHugo_TP2_11.m new file mode 100644 index 0000000..ddcb8f9 --- /dev/null +++ b/TP1b/DiogoEliseuHugo_TP2_11.m @@ -0,0 +1,25 @@ +%% Inicialização do ambiente +clear ; close all; clc + +%% Exercício 11 +n = 0:255; %% Inicialização do ambiente + + +x = cos((20 * pi * n)/256) + cos((200 * pi * n)/256); + +figure +subplot(3, 1, 1) +stem(n, x) + +subplot(3, 1, 2) +y1 = 0.5 * x + 0.4 * [x(1, 2:size(x, 2)) 0] + 0.3 * [x(1, 3:size(x, 2)) 0 0]; +stem(n, y1) + +subplot(3, 1, 3) +y2 = zeros(size(n)); +y2(1) = y1(1); +y2(2) = y1(2); +for i = 3:255 + y2(i) = y1(i) + 0.5 * y2(i - 1) - 0.4 * y2(i - 2); +end +stem(n, y2)