terminated

This commit is contained in:
Diogo Cordeiro 2020-12-14 03:10:51 +00:00
parent 537b9dc6bb
commit 459ba23074
30 changed files with 41 additions and 30 deletions

View File

@ -1,5 +1,5 @@
%% Exercício 13 %% Exercício 13
function [Vmax, Lmax] = DiogoEliseuHugo_TP2_13(X, Y, GRAF) function [Vmax, Lmax] = DiogoEliseuHugo_TP1_13(X, Y, GRAF)
n1 = 1:size(X, 2); n1 = 1:size(X, 2);
n2 = 1:size(Y, 2); n2 = 1:size(Y, 2);
n3 = 1:(size(X, 2) * 2) - 1; n3 = 1:(size(X, 2) * 2) - 1;

View File

@ -1,12 +1,12 @@
%% Exercício 14 %% Exercício 14
function RefN = DiogoEliseuHugo_TP2_14(X) function RefN = DiogoEliseuHugo_TP1_14(X)
N = 1:size(X, 2); N = 1:size(X, 2);
ref = [sin(N); exp(N); exp(-N); N; -N; N.^2]; ref = [sin(N); exp(N); exp(-N); N; -N; N.^2];
maxim = []; maxim = [];
for s = ref' for s = ref'
Vmax = DiogoEliseuHugo_TP2_13(X, s', 1); Vmax = DiogoEliseuHugo_TP1_13(X, s', 1);
maxim = [maxim Vmax]; maxim = [maxim Vmax];
end end

View File

@ -1,5 +1,5 @@
%% Exercício 2 %% Exercício 2
function DiogoEliseuHugo_TP2_2(N1, N2) function DiogoEliseuHugo_TP1_2(N1, N2)
n = N1:N2; n = N1:N2;
% Impulso def % Impulso def

View File

@ -0,0 +1,7 @@
%% Inicialização do ambiente
clear ; close all; clc
%% Exercício 3
DiogoEliseuHugo_TP1_2(-10,30);
DiogoEliseuHugo_TP1_2(-50,20);
DiogoEliseuHugo_TP1_2(-100,100);

View File

@ -1,5 +1,5 @@
%% Exercício 5 %% Exercício 5
function DiogoEliseuHugo_TP2_5(X) function DiogoEliseuHugo_TP1_5(X)
plot(X); plot(X);
fprintf('L_1: %d\n', norma(X,1)); fprintf('L_1: %d\n', norma(X,1));
fprintf('L_2: %f\n', norma(X,2)); fprintf('L_2: %f\n', norma(X,2));

View File

@ -1,5 +1,5 @@
%% Exercício 6 %% Exercício 6
function er = DiogoEliseuHugo_TP2_6(X1,X2) function er = DiogoEliseuHugo_TP1_6(X1,X2)
er = norma(X2-X1,2) / norma(X1,2); er = norma(X2-X1,2) / norma(X1,2);
end end

View File

@ -21,4 +21,4 @@ hold off
legend('s', 'r', 'x') legend('s', 'r', 'x')
title(['Erro de aproximação de x a s: ' num2str(DiogoEliseuHugo_TP2_6(s, x))]) title(['Erro de aproximação de x a s: ' num2str(DiogoEliseuHugo_TP1_6(s, x))])

View File

@ -38,5 +38,5 @@ plot(y5)
hold off hold off
legend('s', 'x', 'y3', 'y5'); legend('s', 'x', 'y3', 'y5');
errors = ['Ex: ' num2str(DiogoEliseuHugo_TP2_6(x, s)) ' Ey3: ' num2str(DiogoEliseuHugo_TP2_6(y3, s)) ' Ey5: ' num2str(DiogoEliseuHugo_TP2_6(y5, s))]; errors = ['Ex: ' num2str(DiogoEliseuHugo_TP1_6(x, s)) ' Ey3: ' num2str(DiogoEliseuHugo_TP1_6(y3, s)) ' Ey5: ' num2str(DiogoEliseuHugo_TP1_6(y5, s))];
title(errors) title(errors)

View File

@ -1,7 +0,0 @@
%% Inicialização do ambiente
clear ; close all; clc
%% Exercício 3
DiogoEliseuHugo_TP2_2(-10,30);
DiogoEliseuHugo_TP2_2(-50,20);
DiogoEliseuHugo_TP2_2(-100,100);

View File

@ -5,9 +5,11 @@ den = [ 1 -0.2 ];
subplot(2,1,1) subplot(2,1,1)
h60 = impz(num, den, 60); h60 = impz(num, den, 60);
stem(h60,'filled') stem(h60,'filled')
xlabel("n (samples)"); ylabel("Amplitude");
subplot(2,1,2) subplot(2,1,2)
[z, p, ~] = tf2zp(num, den); [z, p, ~] = tf2zp(num, den);
zplane(z, p) zplane(z, p)
sgtitle("H1");
figure(2) figure(2)
num = [ 4.5 -1.3 1.4 ]; num = [ 4.5 -1.3 1.4 ];
@ -15,9 +17,11 @@ den = [ 1 0.2 0.75 -0.27 ];
subplot(2,1,1) subplot(2,1,1)
h60 = impz(num, den, 60); h60 = impz(num, den, 60);
stem(h60,'filled') stem(h60,'filled')
xlabel("n (samples)"); ylabel("Amplitude");
subplot(2,1,2) subplot(2,1,2)
[z, p, ~] = tf2zp(num, den); [z, p, ~] = tf2zp(num, den);
zplane(z, p) zplane(z, p)
sgtitle("H2");
figure(3) figure(3)
num = [ 0.5 ]; num = [ 0.5 ];
@ -25,9 +29,11 @@ den = [ 1 -1 0.15 ];
subplot(2,1,1) subplot(2,1,1)
h60 = impz(num, den, 60); h60 = impz(num, den, 60);
stem(h60,'filled') stem(h60,'filled')
xlabel("n (samples)"); ylabel("Amplitude");
subplot(2,1,2) subplot(2,1,2)
[z, p, ~] = tf2zp(num, den); [z, p, ~] = tf2zp(num, den);
zplane(z, p) zplane(z, p)
sgtitle("H3");
figure(4) figure(4)
num = [ 3 4.5 ]; num = [ 3 4.5 ];
@ -35,9 +41,11 @@ den = [ 1 -2.9 -2.1 ];
subplot(2,1,1) subplot(2,1,1)
h60 = impz(num, den, 60); h60 = impz(num, den, 60);
stem(h60,'filled') stem(h60,'filled')
xlabel("n (samples)"); ylabel("Amplitude");
subplot(2,1,2) subplot(2,1,2)
[z, p, ~] = tf2zp(num, den); [z, p, ~] = tf2zp(num, den);
zplane(z, p) zplane(z, p)
sgtitle("H4");
figure(5) figure(5)
num = [ 1 ]; num = [ 1 ];
@ -45,9 +53,11 @@ den = [ 1 -1.845 0.850856 ];
subplot(2,1,1) subplot(2,1,1)
h60 = impz(num, den, 60); h60 = impz(num, den, 60);
stem(h60,'filled') stem(h60,'filled')
xlabel("n (samples)"); ylabel("Amplitude");
subplot(2,1,2) subplot(2,1,2)
[z, p, ~] = tf2zp(num, den); [z, p, ~] = tf2zp(num, den);
zplane(z, p) zplane(z, p)
sgtitle("H5");
figure(6) figure(6)
num = [ 1 ]; num = [ 1 ];
@ -55,6 +65,8 @@ den = [ 1 -1.85 0.85 ];
subplot(2,1,1) subplot(2,1,1)
h60 = impz(num, den, 60); h60 = impz(num, den, 60);
stem(h60,'filled') stem(h60,'filled')
xlabel("n (samples)"); ylabel("Amplitude");
subplot(2,1,2) subplot(2,1,2)
[z, p, k] = tf2zp(num, den); [z, p, k] = tf2zp(num, den);
zplane(z, p) zplane(z, p)
sgtitle("H6");

View File

@ -1,5 +1,5 @@
%% Inicialização do ambiente %% Inicialização do ambiente
clear ; close all; clc clear; close all; clc
%% Exercício 2 %% Exercício 2
sintetico_data = fopen('sintetico.csv'); sintetico_data = fopen('sintetico.csv');

View File

@ -1,5 +1,5 @@
%% Inicialização do ambiente %% Inicialização do ambiente
clear ; close all; clc clear; close all; clc
%% Exercício 3 %% Exercício 3
sintetico_data = fopen('sintetico.csv'); sintetico_data = fopen('sintetico.csv');
@ -8,11 +8,11 @@ sintetico = sintetico{1,1};
fclose(sintetico_data); fclose(sintetico_data);
N = length(sintetico); N = length(sintetico);
FS = 8; Fs = 8;
f = (0:N-1)/N*FS; f = linspace(0, 2*pi*Fs, N)/(pi*Fs);
T = 0.125; T = 0.125;
t = (0:N-1)/N*T; t = (1:N)/N*T;
figure(1) figure(1)
@ -23,14 +23,14 @@ xlabel('t'), ylabel('x(t)'), title('sinal sintetico');
subplot(2,2,2) subplot(2,2,2)
DFT_Xa = fft(sintetico, N); DFT_Xa = fft(sintetico, N);
plot(f, abs(DFT_Xa)) plot(f, abs(DFT_Xa))
xlabel('\omega/\pi'), ylabel('|X(\omega)|'), title('DFT sintetico em [0, 2\pi]') xlabel('\omega/2\pi'), ylabel('|X(\omega)|'), title('DFT sintetico em [0, 2\pi]')
subplot(2,2,3) subplot(2,2,3)
low_pass_filter = ones(N,1); low_pass_filter = ones(N,1);
low_pass_filter(81:177) = 0; % 2.5 H 5.5 low_pass_filter(81:177) = 0; % 2.5 H 5.5
DFT_Xa_filtered = DFT_Xa.*low_pass_filter; DFT_Xa_filtered = DFT_Xa.*low_pass_filter;
plot(f, abs(DFT_Xa_filtered)) plot(f, abs(DFT_Xa_filtered))
xlabel('\omega/\pi'), ylabel('|Y(\omega)|'), title('DFT sintetico em [0, 2\pi] filtrada') xlabel('\omega/2\pi'), ylabel('|Y(\omega)|'), title('DFT sintetico em [0, 2\pi] filtrada')
subplot(2,2,4) subplot(2,2,4)
plot(t, abs(ifft(DFT_Xa_filtered))); plot(t, abs(ifft(DFT_Xa_filtered)));

View File

@ -1,5 +1,5 @@
%% Inicialização do ambiente %% Inicialização do ambiente
clear ; close all; clc clear; close all; clc
%% Exercício 4 %% Exercício 4
fc = 0.3; fc = 0.3;

View File

@ -1,5 +1,5 @@
%% Inicialização do ambiente %% Inicialização do ambiente
clear ; close all; clc clear; close all; clc
%% Exercício 6 %% Exercício 6
sintetico_data = fopen('sintetico.csv'); sintetico_data = fopen('sintetico.csv');

View File

@ -1 +0,0 @@
1,-0.67391,1.1587,0.3128,0.93612,1.2837,0.90455,1.7785,1.3046,1.8455,1.852,1.9125,2.1352,2.2587,2.0989,2.7274,2.0553,2.978,2.2675,2.918,2.6486,2.7807,2.9186,2.8027,2.9677,2.9523,2.9453,3.0443,2.9973,3.0398,3.0493,3.0945,2.9478,3.2825,2.76,3.3982,2.78,3.1627,3.1682,2.6183,3.6665,2.1883,3.8052,2.2527,3.418,2.7086,2.8574,3.0586,2.6196,2.9617,2.7891,2.6157,2.9553,2.5121,2.7074,2.8485,2.1298,3.2838,1.7182,3.3201,1.825,2.8541,2.283,2.2651,2.622,1.9757,2.5832,2.0273,2.3258,2.14,2.143,2.1069,2.1005,2.001,2.0436,1.9762,1.8962,1.9922,1.8025,1.8617,1.9099,1.551,2.1063,1.2945,2.1095,1.323,1.8299,1.5411,1.5277,1.6054,1.5121,1.3558,1.7244,1.0681,1.7491,1.166,1.298,1.6937,0.60739,2.1863,0.24468,2.1365,0.50781,1.5443,1.0989,0.91705,1.4504,0.71957,1.3261,0.90774,1.0143,1.0578,0.93038,0.89404,1.1331,0.57644,1.3133,0.44862,1.2107,0.60587,0.9152,0.81754,0.70896,0.84929,0.70402,0.73493,0.75323,0.66173,0.71245,0.67024,0.65786,0.60662,0.74438,0.39813,0.90648,0.25176,0.85117,0.44768,0.41943,0.94474,-0.12966,1.3207,-0.3255,1.1964,-0.00067769,0.67569,0.49292,0.25683,0.65994,0.28125,0.41659,0.55213,0.17407,0.57822,0.34358,0.1627,0.84136,-0.35305,1.172,-0.47064,0.9837,-0.086321,0.4438,0.42079,0.022946,0.62844,-0.019783,0.4955,0.1566,0.30214,0.25911,0.25538,0.22224,0.28247,0.2009,0.22958,0.2713,0.13727,0.28929,0.19285,0.10775,0.4301,-0.16131,0.61471,-0.2356,0.51604,-0.025333,0.22939,0.2092,0.098326,0.15893,0.28298,-0.11741,0.50752,-0.20443,0.34821,0.18615,-0.23908,0.81811,-0.78944,1.1239,-0.79564,0.80571,-0.25768,0.16132,0.31715,-0.24173,0.46395,-0.16727,0.2268,0.096406,0.029416,0.13387,0.1476,-0.11362,0.4212,-0.33705,0.50661,-0.27613,0.30851,-0.020671,0.057516,0.14698,-0.012093,0.1148,0.065862,0.029884,0.10406,0.036342,0.061896,0.057948,0.093187,-0.060251,0.27064,-0.25277,0.38721,-0.22665,0.16269,0.17708,-0.36181,0.6993,-0.76408,0.86938,-0.66503,0.51987,-0.16845,0.0026036,0.22725,-0.18708,0.18064,0.034568,-0.11148,0.2563,-0.1579,0.066897,0.23816
1 1 -0.67391 1.1587 0.3128 0.93612 1.2837 0.90455 1.7785 1.3046 1.8455 1.852 1.9125 2.1352 2.2587 2.0989 2.7274 2.0553 2.978 2.2675 2.918 2.6486 2.7807 2.9186 2.8027 2.9677 2.9523 2.9453 3.0443 2.9973 3.0398 3.0493 3.0945 2.9478 3.2825 2.76 3.3982 2.78 3.1627 3.1682 2.6183 3.6665 2.1883 3.8052 2.2527 3.418 2.7086 2.8574 3.0586 2.6196 2.9617 2.7891 2.6157 2.9553 2.5121 2.7074 2.8485 2.1298 3.2838 1.7182 3.3201 1.825 2.8541 2.283 2.2651 2.622 1.9757 2.5832 2.0273 2.3258 2.14 2.143 2.1069 2.1005 2.001 2.0436 1.9762 1.8962 1.9922 1.8025 1.8617 1.9099 1.551 2.1063 1.2945 2.1095 1.323 1.8299 1.5411 1.5277 1.6054 1.5121 1.3558 1.7244 1.0681 1.7491 1.166 1.298 1.6937 0.60739 2.1863 0.24468 2.1365 0.50781 1.5443 1.0989 0.91705 1.4504 0.71957 1.3261 0.90774 1.0143 1.0578 0.93038 0.89404 1.1331 0.57644 1.3133 0.44862 1.2107 0.60587 0.9152 0.81754 0.70896 0.84929 0.70402 0.73493 0.75323 0.66173 0.71245 0.67024 0.65786 0.60662 0.74438 0.39813 0.90648 0.25176 0.85117 0.44768 0.41943 0.94474 -0.12966 1.3207 -0.3255 1.1964 -0.00067769 0.67569 0.49292 0.25683 0.65994 0.28125 0.41659 0.55213 0.17407 0.57822 0.34358 0.1627 0.84136 -0.35305 1.172 -0.47064 0.9837 -0.086321 0.4438 0.42079 0.022946 0.62844 -0.019783 0.4955 0.1566 0.30214 0.25911 0.25538 0.22224 0.28247 0.2009 0.22958 0.2713 0.13727 0.28929 0.19285 0.10775 0.4301 -0.16131 0.61471 -0.2356 0.51604 -0.025333 0.22939 0.2092 0.098326 0.15893 0.28298 -0.11741 0.50752 -0.20443 0.34821 0.18615 -0.23908 0.81811 -0.78944 1.1239 -0.79564 0.80571 -0.25768 0.16132 0.31715 -0.24173 0.46395 -0.16727 0.2268 0.096406 0.029416 0.13387 0.1476 -0.11362 0.4212 -0.33705 0.50661 -0.27613 0.30851 -0.020671 0.057516 0.14698 -0.012093 0.1148 0.065862 0.029884 0.10406 0.036342 0.061896 0.057948 0.093187 -0.060251 0.27064 -0.25277 0.38721 -0.22665 0.16269 0.17708 -0.36181 0.6993 -0.76408 0.86938 -0.66503 0.51987 -0.16845 0.0026036 0.22725 -0.18708 0.18064 0.034568 -0.11148 0.2563 -0.1579 0.066897 0.23816