From c31b5a86bba205905d8e872ae5e4264a7a04ee9a Mon Sep 17 00:00:00 2001 From: rainydaysavings Date: Sat, 24 Oct 2020 18:20:32 +0100 Subject: [PATCH] ex11: terminated. (for real) --- TP1b/DiogoEliseuHugo_TP2_11.m | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/TP1b/DiogoEliseuHugo_TP2_11.m b/TP1b/DiogoEliseuHugo_TP2_11.m index ddcb8f9..e29cc0a 100644 --- a/TP1b/DiogoEliseuHugo_TP2_11.m +++ b/TP1b/DiogoEliseuHugo_TP2_11.m @@ -2,24 +2,19 @@ clear ; close all; clc %% Exercício 11 -n = 0:255; %% Inicialização do ambiente +n = 0:255; +x = cos(20*pi*n/256)+cos(200*pi*n/256); +cx1 = [0.5,0.4,0.3]; +y1 = filter(cx1,1,x); -x = cos((20 * pi * n)/256) + cos((200 * pi * n)/256); +cx2 = [0.4,0.5,0.4]; +cy2 = [1,-0.5,0.4]; +y2 = filter(cx2,cy2,x); -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) +subplot(3,1,1),plot(n,x) +xlabel('n'),ylabel('Amplitude'),title('x[n]') +subplot(3,1,2),plot(n,y1) +xlabel('n'),ylabel('Amplitude'),title('y1[n]') +subplot(3,1,3),plot(n,y2) +xlabel('n'),ylabel('Amplitude'),title('y2[n]') \ No newline at end of file