diff --git a/TP3a/DiogoEliseu_TP3_2.m b/TP3a/DiogoEliseu_TP3_2.m index 477815b..93f07bc 100644 --- a/TP3a/DiogoEliseu_TP3_2.m +++ b/TP3a/DiogoEliseu_TP3_2.m @@ -31,7 +31,7 @@ figure(1) subplot(2,1,1) plot(sintetico); -xlabel('t'), ylabel('sintetico(t)'), title('sinal sintetico'); +xlabel('t'), ylabel('sintetico[t]'), title('sinal sintetico'); subplot(2,1,2) DFT_synth = fft(sintetico, Ls); @@ -43,7 +43,7 @@ figure(2) subplot(2,1,1) plot(cello.x); -xlabel('t'), ylabel('cello(t)'), title('sinal cello'); +xlabel('t'), ylabel('cello[t]'), title('sinal cello'); subplot(2,1,2) DFT_cello = fft(cello.x, Lc); @@ -55,7 +55,7 @@ figure(3) subplot(2,1,1) plot(EEG); -xlabel('t'), ylabel('eeg(t)'), title('sinal EEG'); +xlabel('t'), ylabel('eeg[t]'), title('sinal EEG'); subplot(2,1,2) DFT_EEG = fft(EEG, Le-1); diff --git a/TP3a/DiogoEliseu_TP3_4.m b/TP3a/DiogoEliseu_TP3_4.m new file mode 100644 index 0000000..465044d --- /dev/null +++ b/TP3a/DiogoEliseu_TP3_4.m @@ -0,0 +1,40 @@ +%% Inicialização do ambiente +clear ; close all; clc + +%% Exercício 4 +fc = 0.3; +w = linspace(0, pi, 500); %0:pi/500:pi; +f = w/pi; +order = [ 4, 6, 8, 10]; + +for i=1:4 + % Butterworth + subplot(3,4,i) + [num, den] = butter(order(i), fc, 'low'); %order, cutoff frequency, type + h = freqz(num, den, w); + gain = 20.*log10(abs(h)); + plot(f, gain); + axis([0 1 -60 2]); + title(['Butterworth - ' num2str(order(i)) '.ª Ordem']); + ylabel("Ganho (dB)"); xlabel("\omega/\pi"); + + % Chebyshev + subplot(3,4,i+4) + [num, den] = cheby1(order(i), 0.5, fc, 'low'); %0.5 is tollerance in dB + h = freqz(num, den, w); + gain = 20.*log10(abs(h)); + plot(f, gain); + axis([0 1 -60 2]); + title(['Chebyshev - ' num2str(order(i)) '.ª Ordem']); + ylabel("Ganho (dB)"); xlabel("\omega/\pi"); + + % Eliptico + subplot(3,4,i+4+4) + [num, den] = ellip(order(i), 0.5, 40, fc, 'low'); %0.5 is the tollerance in the top, -40 is the tollerance in the bottom + h = freqz(num, den, w); + gain = 20.*log10(abs(h)); + plot(f, gain); + axis([0 1 -60 2]); + title(['Eliptico - ' num2str(order(i)) '.ª Ordem']); + ylabel("Ganho (dB)"); xlabel("\omega/\pi"); +end