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/TP1a/DiogoEliseuHugo_TP2_2.m
Diogo Cordeiro e4da058aad [new] add second assignment
organize file structuure.
2020-10-15 14:32:06 +01:00

36 lines
634 B
Matlab

%% Exercício 2
function DiogoEliseuHugo_TP2_2(N1, N2)
n = N1:N2;
% 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)
title('x')
% Plot do impulso
subplot(2,2,3)
stem(n, impulso)
title('\delta')
% Plot do degrau
subplot(2,2,4)
stem(n, degrau)
title('\mu')
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);
end