This commit is contained in:
Diogo Cordeiro 2020-12-10 14:21:46 +00:00
parent adcbb6800a
commit bd3a4977c3
2 changed files with 43 additions and 3 deletions

View File

@ -31,7 +31,7 @@ figure(1)
subplot(2,1,1) subplot(2,1,1)
plot(sintetico); plot(sintetico);
xlabel('t'), ylabel('sintetico(t)'), title('sinal sintetico'); xlabel('t'), ylabel('sintetico[t]'), title('sinal sintetico');
subplot(2,1,2) subplot(2,1,2)
DFT_synth = fft(sintetico, Ls); DFT_synth = fft(sintetico, Ls);
@ -43,7 +43,7 @@ figure(2)
subplot(2,1,1) subplot(2,1,1)
plot(cello.x); plot(cello.x);
xlabel('t'), ylabel('cello(t)'), title('sinal cello'); xlabel('t'), ylabel('cello[t]'), title('sinal cello');
subplot(2,1,2) subplot(2,1,2)
DFT_cello = fft(cello.x, Lc); DFT_cello = fft(cello.x, Lc);
@ -55,7 +55,7 @@ figure(3)
subplot(2,1,1) subplot(2,1,1)
plot(EEG); plot(EEG);
xlabel('t'), ylabel('eeg(t)'), title('sinal EEG'); xlabel('t'), ylabel('eeg[t]'), title('sinal EEG');
subplot(2,1,2) subplot(2,1,2)
DFT_EEG = fft(EEG, Le-1); DFT_EEG = fft(EEG, Le-1);

40
TP3a/DiogoEliseu_TP3_4.m Normal file
View File

@ -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