[2] Ex1 and 2 terminated.

This commit is contained in:
rainydaysavings 2020-11-12 14:46:51 +00:00 committed by Diogo Cordeiro
parent 8068ef9660
commit eff6c9d24e
2 changed files with 31 additions and 0 deletions

12
TP2/DiogoEliseu_TP2_1.m Normal file
View File

@ -0,0 +1,12 @@
%% Exercício 1
p = [1.8, 0.5, -0.3];
d = [1, 0.5];
w = 0:(4*pi/1023):2*pi;
y2a = freqz(p, d, w);
X = freqz(p, d, w);
subplot(2,1,1),plot(w, abs(X))
xlabel('w'),title('Magnitude')
subplot(2,1,2),plot(w, angle(X))
xlabel('w'),title('Phase')

19
TP2/DiogoEliseu_TP2_2.m Normal file
View File

@ -0,0 +1,19 @@
%% Exercício 2
w1 = (0:15) * 2 * pi / 16;
w2 = (0:1023) * 2 * pi / 1024;
x1 = ones(1,16);
x2 = cos(3 * pi * (0:15) / 8);
DFT1 = fft(x1);
DTFT1 = fft(x1, 1024);
DFT2 = fft(x2);
DTFT2 = fft(x2, 1024);
subplot(2,1,1)
plot(w1, abs(DFT1), w2, abs(DTFT1))
xlabel('cenas'), ylabel('Modulo'), title('DFT / DTFT de x1')
subplot(2,1,2)
plot(w1, abs(DFT2), w2, abs(DTFT2))
xlabel('cenas'), ylabel('Modulo'), title('DFT / DTFT de x2')