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/DiogoEliseuHugo_TP2_1.m

33 lines
500 B
Mathematica
Raw Normal View History

2020-10-04 17:09:12 +01:00
%% Inicialização do ambiente
clear ; close all; clc
%% Exercício 1
n = -20:20; % janela
% Impulso def
2020-10-01 15:59:02 +01:00
impulso = zeros(1,41);
impulso(21) = 1;
2020-10-05 21:15:29 +01:00
% Degrau def
2020-10-04 17:09:12 +01:00
degrau = (n >= 0);
2020-10-01 15:59:02 +01:00
2020-10-04 17:09:12 +01:00
% Figura com os resultados
2020-10-01 15:59:02 +01:00
figure
2020-10-04 17:09:12 +01:00
% Plot da sequência X
subplot(2,2,1:2)
x = fun_x(n);
stem(n, x)
% Plot do impulso
subplot(2,2,3)
2020-10-01 15:59:02 +01:00
stem(n, impulso)
2020-10-04 17:09:12 +01:00
% Plot do degrau
subplot(2,2,4)
2020-10-01 15:59:02 +01:00
stem(n, degrau)
2020-10-04 17:09:12 +01:00
% Definição da sequência X
2020-10-01 15:59:02 +01:00
function p = fun_x(N)
A=1.8;
f=0.05;
phi=0.5*pi;
p=A*cos(2*pi*f*N+phi);
end