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/TP1/DiogoEliseuHugo_TP1_2.m

36 lines
634 B
Mathematica
Raw Permalink Normal View History

2020-10-05 21:15:29 +01:00
%% Exercício 2
2020-12-14 03:10:51 +00:00
function DiogoEliseuHugo_TP1_2(N1, N2)
2020-10-05 21:15:29 +01:00
n = N1:N2;
2020-10-08 15:28:47 +01:00
2020-10-05 21:15:29 +01:00
% Impulso def
impulso = zeros(1, abs(N1) + N2 + 1);
impulso(ceil(length(n)/2)) = 1;
% Degrau def
degrau = (n >= 0);
% Figura com os resultados
figure
% Plot da sequência X
subplot(2,2,1:2)
x = fun_x(n);
stem(n, x)
2020-10-08 15:42:51 +01:00
title('x')
2020-10-05 21:15:29 +01:00
% Plot do impulso
subplot(2,2,3)
stem(n, impulso)
2020-10-08 15:42:51 +01:00
title('\delta')
2020-10-05 21:15:29 +01:00
% Plot do degrau
subplot(2,2,4)
stem(n, degrau)
2020-10-08 15:42:51 +01:00
title('\mu')
2020-10-05 21:15:29 +01:00
end
%% Definição da sequência X
function p = fun_x(N)
A=1.8;
f=0.05;
phi=0.5*pi;
p=A*cos(2*pi*f*N+phi);
2020-10-08 15:28:47 +01:00
end