Insane Progress

This commit is contained in:
Diogo Cordeiro 2020-11-15 21:51:27 +00:00
parent eff6c9d24e
commit d92f141b72
3 changed files with 90 additions and 12 deletions

View File

@ -2,8 +2,7 @@
p = [1.8, 0.5, -0.3];
d = [1, 0.5];
w = 0:(4*pi/1023):2*pi;
y2a = freqz(p, d, w);
w = -4*pi:(8*pi/999):4*pi;
X = freqz(p, d, w);
subplot(2,1,1),plot(w, abs(X))

View File

@ -1,19 +1,25 @@
%% 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);
N = (0:15);
DFT1 = fft(x1);
x1 = ones(1,16);
x2 = cos(3*pi.*N./8);
DFT1 = fft(x1, 16);
DTFT1 = fft(x1, 1024);
DFT2 = fft(x2);
DFT2 = fft(x2, 16);
DTFT2 = fft(x2, 1024);
subplot(2,1,1)
plot(w1, abs(DFT1), w2, abs(DTFT1))
xlabel('cenas'), ylabel('Modulo'), title('DFT / DTFT de x1')
stem(x2)
subplot(2,1,2)
plot(w1, abs(DFT2), w2, abs(DTFT2))
hold on
stem(X(16),abs(DFT2))
plot(X(1024), abs(DTFT2))
hold off
xlabel('cenas'), ylabel('Modulo'), title('DFT / DTFT de x2')
function f = X(N)
f = 0:(1/N):(1 - 1/N);
end

73
TP2/DiogoEliseu_TP2_3.m Normal file
View File

@ -0,0 +1,73 @@
% Exercício 3
% signals
N = 256;
n = (0:N-1);
X1 = 2*N*0.97.^n;
X2 = cos(6*pi*n/N);
X3 = sin(12*pi*n/N);
% freq conv
X1_fft = fft(X1);
X2_fft = fft(X2);
X3_fft = fft(X3);
X1_X2_f = ifft(X1_fft.*X2_fft);
X1_X3_f = ifft(X1_fft.*X3_fft);
X2_X3_f = ifft(X2_fft.*X3_fft);
% time conv
X1_X2_t = conv(X1, X2);
X1_X3_t = conv(X1, X3);
X2_X3_t = conv(X2, X3);
%--- plots
% signals
subplot(3,3,1)
plot(X1);
%title("Sinal X1")
xlabel("n")
ylabel("X1")
subplot(3,3,2)
plot(X2);
title("Sinais")
xlabel("n")
ylabel("X2")
subplot(3,3,3)
plot(X3);
%title("Sinal X3")
xlabel("n")
ylabel("X3")
% time
subplot(3,3,4)
plot(X1_X2_t);
%title("X1 * X2 no domínio do tempo")
xlabel("n")
ylabel("X1(t) * X2(t)")
subplot(3,3,5)
plot(X1_X3_t);
title("*(t)")
xlabel("n")
ylabel("X1(t) * X3(t)")
subplot(3,3,6)
plot(X2_X3_t);
%title("X2 * X3 no domínio do tempo")
xlabel("n")
ylabel("X2(t) * X3(t)")
% freq
subplot(3,3,7)
plot(X1_X2_f);
%title("X1 * X2 no domínio da freq")
xlabel("n")
ylabel("X1(\omega) * X2(\omega)")
subplot(3,3,8)
plot(X1_X3_f);
title("*(\omega)")
xlabel("n")
ylabel("X1(\omega) * X3(\omega)")
subplot(3,3,9)
plot(X2_X3_f);
%title("X2 * X3 no domínio da freq")
xlabel("n")
ylabel("X2(\omega) * X3(\omega)")