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_1.m

37 lines
541 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)
2020-10-08 15:42:51 +01:00
title('x')
2020-10-04 17:09:12 +01:00
% Plot do impulso
subplot(2,2,3)
2020-10-01 15:59:02 +01:00
stem(n, impulso)
2020-10-08 15:42:51 +01:00
title('\delta')
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-08 15:42:51 +01:00
title('\mu')
2020-10-01 15:59:02 +01:00
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);
2020-10-08 15:32:24 +01:00
end