Mudanças entre as edições de "PSD29007-Engtelecom(2020-1) - Prof. Marcos Moecke"
Ir para navegação
Ir para pesquisar
(→ATUAL) |
|||
Linha 380: | Linha 380: | ||
:* Consulte a documentação do Matlab sobre [https://www.mathworks.com/help/matlab/ref/text.html text], [http://www.mathworks.com/help/signal/ref/zp2tf.html zp2tf], [http://www.mathworks.com/help/signal/ref/tf2zp.html tf2zp], [http://www.mathworks.com/help/signal/ref/fftfilt.html fftfilt], [http://www.mathworks.com/help/matlab/ref/awgn.html awgn] | :* Consulte a documentação do Matlab sobre [https://www.mathworks.com/help/matlab/ref/text.html text], [http://www.mathworks.com/help/signal/ref/zp2tf.html zp2tf], [http://www.mathworks.com/help/signal/ref/tf2zp.html tf2zp], [http://www.mathworks.com/help/signal/ref/fftfilt.html fftfilt], [http://www.mathworks.com/help/matlab/ref/awgn.html awgn] | ||
:*Ver pag. 141 a 145 e 230 a 235 de <ref name="DINIZ2014"/> | :*Ver pag. 141 a 145 e 230 a 235 de <ref name="DINIZ2014"/> | ||
+ | --> | ||
+ | {{collapse bottom}} | ||
+ | |||
+ | ===Unidade 2=== | ||
+ | {{collapse top | expand=true | Unidade 2}} | ||
+ | ;Aula 9 (12 mar): | ||
+ | *Filtros Analógicos: | ||
+ | :* Função de transferência | ||
+ | ::<math> H(s) = \frac {c_0 + c_1 s + c_2 s^2 + ... + c_m s^m} {d_0 + d_1 s + d_2 s^2 + ... + d_n s^n}, m \le n</math> | ||
+ | |||
+ | :* Resposta em frequência: para obter a resposta em frequência é necessário avaliar | ||
+ | ::<math>H(j\omega) = H(s)\left|\begin{matrix}\\ s=j\omega \end{matrix}\right.</math> | ||
+ | |||
+ | ::<math> H(j \omega) = \left | H(j \omega) \right | e^{j \phi(\omega)}</math> | ||
+ | |||
+ | ::<math> \left | H(j \omega) \right |^2 = H(j \omega) H(-j \omega)</math> | ||
+ | |||
+ | ::<math> e^{j 2 \phi(\omega)} = \frac {H(j \omega)} {H(-j \omega)}</math> | ||
+ | :* O projeto de filtros analógicos é realizado em 2 etapas: | ||
+ | # projeto de um filtro passa baixas (LP) protótipo normalizado <math> H(p) </math> com frequência de passagem <math> \Omega_s = 1 </math> | ||
+ | # transformação em frequência para o tipo de filtro (LP, HP, BP ou BS) | ||
+ | ::<math> H(s) = H(p)\left|\begin{matrix}\\ p=g(s) \end{matrix}\right. </math> | ||
+ | |||
+ | * Análise básica de filtros analógicos com Matlab. | ||
+ | :Dado um sistema linear invariante no tempo, representado pela função de transferência <math> H(s) </math>, obter a resposta de frequência do sistema (Magnitude e Fase). | ||
+ | ::<math> H(s) = \frac {s + 1} {s^2 + s + 5} </math> | ||
+ | ::<math> H(j\omega) = \frac {s + 1} {s^2 + s + 5}\left|\begin{matrix}\\ s=j\omega \end{matrix}\right.</math> | ||
+ | ::<math> H(j\omega) = \frac{1 + w\, \mathrm{i}}{ - w^2 + w\, \mathrm{i} + 5} </math> | ||
+ | |||
+ | <syntaxhighlight lang=matlab> | ||
+ | b = [1 1]; | ||
+ | a = [1 1 5]; | ||
+ | [z1,p1,k]=tf2zp(b,a) | ||
+ | z2 = roots(b); | ||
+ | p2 = roots(a); | ||
+ | zplane(b,a); | ||
+ | %% | ||
+ | freqs(b,a); | ||
+ | %% | ||
+ | syms s w | ||
+ | H(s) = (s+1)/(s^2 + s + 5); | ||
+ | pretty(H(1j*w)) | ||
+ | latex(H(1j*w)) | ||
+ | %% | ||
+ | ws = logspace(-2, 1, 1000); | ||
+ | h = H(1j*ws); | ||
+ | subplot(211) | ||
+ | semilogx(ws,abs(h)); grid on; | ||
+ | subplot(212) | ||
+ | semilogx(ws,angle(h)/pi*180); grid on; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Projeto de filtros analógicos do tipo Butterworth | ||
+ | :* A aproximação de magnitude de filtros analógicos pode ser realizado usando as aproximações de Butterworth, Chebyshev (tipo 1 ou 2) e Cauer. | ||
+ | |||
+ | [[Arquivo:TiposFiltrosHs.png | 600px]] | ||
+ | |||
+ | ;Proposta de exercício: | ||
+ | *Use os polinômios de Butterworth com ordens de 1 a 10 mostrados na tabela abaixo para obter os filtros <math>H_n(s) = 1/B_n(s)</math>. | ||
+ | |||
+ | {| | ||
+ | |----- | ||
+ | | | ||
+ | {| class="wikitable" style="text-align: center;" | ||
+ | |- | ||
+ | !n!!Fatores Polinomiais de <math>B_n(s)</math> | ||
+ | |- | ||
+ | !1 | ||
+ | |<math>(s+1)</math> | ||
+ | |- | ||
+ | !2 | ||
+ | |<math>(s^2+1.4142s+1)</math> | ||
+ | |- | ||
+ | !3 | ||
+ | |<math>(s+1)(s^2+s+1)</math> | ||
+ | |- | ||
+ | !4 | ||
+ | |<math>(s^2+0.7654s+1)(s^2+1.8478s+1)</math> | ||
+ | |- | ||
+ | !5 | ||
+ | |<math>(s+1)(s^2+0.6180s+1)(s^2+1.6180s+1)</math> | ||
+ | |- | ||
+ | !6 | ||
+ | |<math>(s^2+0.5176s+1)(s^2+1.4142s+1)(s^2+1.9319s+1)</math> | ||
+ | |- | ||
+ | !7 | ||
+ | |<math>(s+1)(s^2+0.4450s+1)(s^2+1.2470s+1)(s^2+1.8019s+1)</math> | ||
+ | |- | ||
+ | !8 | ||
+ | |<math>(s^2+0.3902s+1)(s^2+1.1111s+1)(s^2+1.6629s+1)(s^2+1.9616s+1)</math> | ||
+ | |- | ||
+ | !9 | ||
+ | |<math>(s+1)(s^2+0.3473s+1)(s^2+s+1)(s^2+1.5321s+1)(s^2+1.879s+1)</math> | ||
+ | |- | ||
+ | !10 | ||
+ | |<math>(s^2+0.3129s+1)(s^2+0.9080s+1)(s^2+1.4142s+1)(s^2+1.7820s+1)(s^2+1.9754s+1)</math> | ||
+ | |} | ||
+ | |} | ||
+ | *Escolha uma ordem n (entre 5 e 10) | ||
+ | *Plote a resposta em frequência em escala log da amplitude (em dB) e da fase (em rad/pi). | ||
+ | *Qual é o ganho do filtro na banda passante? | ||
+ | *Qual é a frequência de corte (-3dB) do filtro. | ||
+ | *Qual é o salto de de fase que ocorre em algumas frequências? | ||
+ | *Qual é o fator de atenuação em dB/decada após a frequência de corte? | ||
+ | |||
+ | *Faça o diagrama de polos e zeros desse filtro. | ||
+ | *Procure observar o que ocorre com a posição dos polos do filtro. | ||
+ | *Calcule o valor do módulo dos pólos. | ||
+ | <!-- | ||
+ | |||
+ | ;Aula 9, 10 (16, 26 ago): | ||
+ | |||
+ | * Projeto de filtros analógicos passa baixas (low pass - LP) do tipo Butterworth, considerando: <math> \omega_p </math> é a frequência de passagem, <math> A_p = 3 dB </math> é a atenuação em dB na frequência de passagem, <math> \omega_s </math> é a frequência de ''stopband'', <math> A_s </math> é a atenuação em dB na frequência de ''stopband''. | ||
+ | [[Arquivo:MascaraFiltroLP.png | 600px]] | ||
+ | |||
+ | *Escalando as frequências em relação a <math> {\omega_p} </math>, teremos que <math> \Omega_s = \frac {\omega_s} {\omega_p} </math>, e <math> \Omega_p = \frac {\omega_p} {\omega_p} = 1 </math> são as frequências de passagem e ''stopband'' do filtro protótipo <math> H(p) </math>, que tem ganho unitário e frequência de passagem 1. | ||
+ | |||
+ | ;<math> A_p = 3 dB </math>: | ||
+ | *Se considerarmos o caso particular em que na frequência de passagem o ganho (em escala linear) deve ser <math> G_p = 1/\sqrt{2} = 0,707 </math>, que corresponde a um ganho (em escala log) <math> G_p = - 3 dB </math>, ou atenuação <math> A_p = 3 dB </math>. | ||
+ | *Considere que <math> \epsilon = \sqrt{10^{0.1A_p}-1}</math>, teremos <math> \epsilon = 1 </math> | ||
+ | *Para projetar o filtro é necessário: | ||
+ | |||
+ | :1) determinar a ordem <math> n </math> do filtro: | ||
+ | |||
+ | ::<math> n \ge \frac {\log(10^{0.1A_s}-1)} {2 \log \Omega_s} </math> | ||
+ | |||
+ | :2) obter os polos do filtro: | ||
+ | |||
+ | ::<math> p_k = e^{\left[ j \frac{(2 k + n - 1)} {2 n} \pi \right]}, k = 1, 2, 3, ... n</math> | ||
+ | |||
+ | :3) obter a função de transferência: | ||
+ | |||
+ | ::<math> H(p)= \frac{1}{D(p)} </math>, onde <math> D(p)=\prod_{k=1}^{n} \left ( p-p_{k} \right ) </math> | ||
+ | |||
+ | ::* No caso de um filtro LP é necessário ainda obter a função de transferência do filtro especificado fazendo a transformação de frequência <math> H(p) -> H(s) </math> | ||
+ | |||
+ | ::<math>H(s) = H(p)\left|\begin{matrix} \\ p=\frac{s}{\omega_p} \end{matrix}\right. </math> | ||
+ | |||
+ | |||
+ | ;Para qualquer <math> A_p </math>: | ||
+ | *Teremos <math> \epsilon = \sqrt{10^{0.1A_p}-1}</math> | ||
+ | |||
+ | *Para projetar o filtro é necessário: | ||
+ | :1) determinar a ordem <math> n </math> do filtro: | ||
+ | |||
+ | ::<math> n \ge \frac {\log[(10^{0.1A_s}-1)/\epsilon^2]} {2 \log \Omega_s} </math> | ||
+ | |||
+ | :2) obter os polos do filtro: | ||
+ | |||
+ | ::<math> p_k = \epsilon^{(-1/n)} e^{\left[ j \frac{(2 k + n - 1)} {2 n} \pi \right]}, k = 1, 2, 3, ... n</math> | ||
+ | |||
+ | :3) obter a função de transferência: | ||
+ | |||
+ | ::<math> H(p)= \frac{k}{D(p)} </math>, onde <math> k=\prod_{k=1}^{n} \left (-p_{k} \right ) = \epsilon^{-1}</math> e <math> D(p)=\prod_{k=1}^{n} \left ( p-p_{k} \right ) </math>. | ||
+ | ::NOTA: o valor <math> k </math> também pode ser obtido a partir de <math> {D(p)} </math>, pois corresponde ao último termo do polinômio <math> {D(end)} </math>. | ||
+ | |||
+ | ::* No caso de um filtro LP é necessário ainda obter a função de transferência do filtro especificado fazendo a transformação de frequência <math> H(p) -> H(s) </math> | ||
+ | ::<math>H(s) = H(p)\left|\begin{matrix} \\ p=\frac{s}{\omega_p} \end{matrix}\right. </math> | ||
+ | |||
+ | :*Ver [[Uso do calculo simbólico na Matlab]] | ||
+ | :*Ver pag. 186 a 204 de <ref name="SHENOI2006"> SHENOI, B. A. '''Introduction to Digital Signal Processing and Filter Design'''. 1.ed. New Jersey: John Wiley-Interscience, 2006. 440 p. ISBN 978-0471464822 </ref> | ||
+ | |||
+ | <!-- | ||
+ | <syntaxhighlight lang=matlab> | ||
+ | %Butterworth lowpass Responses (db) | ||
+ | w = 0.1:0.01:10; | ||
+ | H=inline('10*log10(1./(1+w.^(2*n)))','w','n'); | ||
+ | for k = 1:1:10 | ||
+ | semilogx(w,H(w,k)); hold on; | ||
+ | end | ||
+ | grid on | ||
+ | |||
+ | %Butterworth lowpass Responses (linear) | ||
+ | w = 0.1:0.01:2; | ||
+ | H=inline('1./(1+w.^(2*n))','w','n'); | ||
+ | for k = 1:1:10 | ||
+ | plot(w,H(w,k)); hold on; | ||
+ | end | ||
+ | grid on | ||
+ | </syntaxhighlight> | ||
+ | --> | ||
+ | |||
+ | |||
+ | ;Aula 11 e 12 (29 ago e 2 set): | ||
+ | * Projeto de filtros analógicos do tipo Chebyshev I. | ||
+ | :* Polinômios de Chebyshev: | ||
+ | :<math>C_n(\Omega) = cos (n cos^{-1}(\Omega))\!</math> | ||
+ | Os polinômios de Chebyshev de primeira ordem são definidos pela relação recursiva: | ||
+ | :<math>C_0(\Omega) = 1 \,\!</math> | ||
+ | :<math>C_1(\Omega) = \Omega \,\!</math> | ||
+ | :<math>C_{n}(\Omega) = 2 \times \Omega \times C_{n-1}(\Omega) - C_{n-2}(\Omega). \,\!</math> | ||
+ | |||
+ | Os primeiros cinco polinômios de Chebyshev de primeira ordem são: | ||
+ | :<math> C_0(\Omega) = 1 \,</math> | ||
+ | :<math> C_1(\Omega) = \Omega \,</math> | ||
+ | :<math> C_2(\Omega) = 2\Omega^2 - 1 \,</math> | ||
+ | :<math> C_3(\Omega) = 4\Omega^3 - 3\Omega \,</math> | ||
+ | :<math> C_4(\Omega) = 8\Omega^4 - 8\Omega^2 + 1 \,</math> | ||
+ | :<math> C_5(\Omega) = 16\Omega^5 - 20\Omega^3 + 5\Omega \,</math> | ||
+ | |||
+ | ::*Determine a ordem mínima necessária considerando: <math> \omega_p </math> é a frequência de passagem do filtro LP, <math> A_p </math> é a atenuação em dB na frequência de passagem, <math> \omega_s </math> é a frequência de ''stopband'' do filtro, <math> A_s </math> é a atenuação em dB na frequência de ''stopband'', <math> \epsilon = \sqrt{10^{0.1A_p}-1 } </math>, <math> \Omega_s = \frac {\omega_s} {\omega_p} </math>, <math> \Omega_p = \frac {\omega_p} {\omega_p} = 1 </math> são as frequências de passagem e ''stopband'' do filtro protótipo. | ||
+ | ::<math> n \ge \frac {\cosh^{-1} \sqrt{(10^{0.1A_s}-1)/(10^{0.1A_p}-1)}} {\cosh^{-1} \Omega_s} </math> | ||
+ | |||
+ | ::*Em seguida obter os polos do filtro: | ||
+ | |||
+ | ::<math> p_k = -\sinh(\varphi_2) \sin(\theta_k)+ j \cosh(\varphi_2) \cos(\theta_k) \ \ \ \ \ k = 1, 2, 3, ... n</math>, onde | ||
+ | ::<math> \theta_k = \left ( \frac{(2k-1)\pi}{2n} \right ) </math> | ||
+ | ::<math> \varphi_2 = \frac{1}{n} \sinh^{-1}\left (\frac{1}{\epsilon} \right ) </math> | ||
+ | |||
+ | :<math>\left | H( j\Omega ) \right | ^2 = 1 \text{para n impar}, \frac {1}{1+\epsilon^2} \text{para n par} </math> | ||
+ | |||
+ | :<math>\left | H(0) \right | ^2 = \frac{H_0^2}{ 1+ \epsilon^2 C_n ^2 \left ( \Omega_0 \right )} </math> | ||
+ | |||
+ | ::* Para obter a função de transferência: | ||
+ | |||
+ | ::<math> H(p)= \frac{H0}{D(p)} </math>, onde <math> D(p)=\prod_{k-1}^{n} \left ( p-p_{k} \right ) </math> | ||
+ | ::onde | ||
+ | ::<math> H_0 = d_0*\sqrt{\frac{1}{ 1+ \epsilon^2}} </math> se n é par | ||
+ | ::<math> H_0 = d_0 </math> se n é impar | ||
+ | ::<math> d_0 =\prod_{k-1}^{n} \left (-p_{k} \right ) </math> é o último termo do denominador D(p) | ||
+ | |||
+ | :* Uso das funções [http://www.mathworks.com/help/signal/ref/buttord.html buttord], [http://www.mathworks.com/help/signal/ref/butter.html butter], [http://www.mathworks.com/help/signal/ref/cheb1ord.html cheb1ord], [http://www.mathworks.com/help/signal/ref/cheby1.html cheby1], [http://www.mathworks.com/help/signal/ref/cheb2ord.html cheb2ord], [http://www.mathworks.com/help/signal/ref/cheby2.html cheby2], [http://www.mathworks.com/help/signal/ref/ellipord.html ellipord], [http://www.mathworks.com/help/signal/ref/ellip.html ellip] para o projeto de filtros analógicos com Matlab (é necessário usar o parâmetro ''''s''''). | ||
+ | :* Ler '''Comparison of Analog IIR Lowpass Filters''' em [http://www.mathworks.com/help/signal/ref/ellip.html ellip] | ||
+ | :* Uso das funções [http://www.mathworks.com/help/signal/ref/freqs.html freqs], "zplane", [http://www.mathworks.com/help/signal/ref/fvtool.html fvtool] na análise da resposta em frequência de filtros analógicos. | ||
+ | |||
+ | * Projeto de filtros analógicos do tipo Butterworth, Chebyshev I e II e Cauer (eliptico) usando funções do Matlab. | ||
+ | <syntaxhighlight lang=matlab> | ||
+ | %% Projeto de filtro passa-baixas usando funções do Matlab | ||
+ | %% Especificações do filtro | ||
+ | Wp =16000; Ws = 20000; Ap = 0.3; As = 20; G0= 3; | ||
+ | % Para analisar o filtro projetado, use fvtool(b,a) para observar plano s, resposta em magnitude, fase e atraso de grupo | ||
+ | |||
+ | %% Butterworth | ||
+ | [n,Wn] = buttord(Wp, Ws, Ap, As,'s') | ||
+ | [b,a] = butter(n,Wn, 's'); | ||
+ | |||
+ | %% Chebyshev I | ||
+ | n = cheb1ord(Wp, Ws, Ap, As,'s') | ||
+ | [b,a] = cheby1(n,Ap, Wp, 's'); | ||
+ | |||
+ | %% Chebyshev II | ||
+ | n = cheb2ord(Wp, Ws, Ap, As,'s') | ||
+ | [b,a] = cheby2(n,As, Ws, 's'); | ||
+ | |||
+ | %% Elliptic - Cauer | ||
+ | [n, Wn] = ellipord(Wp, Ws, Ap, As,'s') | ||
+ | [b,a] = ellip(n,Ap,As, Wn, 's'); | ||
+ | </syntaxhighlight> | ||
+ | :*Ver pag. 204 a 208 de <ref name="SHENOI2006"/> | ||
+ | |||
+ | |||
+ | ;Aula 13 e 14 (5 e 9 set): | ||
+ | *Filtros Analógicos: | ||
+ | :* Transformações de frequência de filtros analógicos | ||
+ | :*passa-baixas (<math> \Omega_p= 1 </math>) -> passa-baixas (<math> \omega_p</math>) | ||
+ | ::*Cálculo do protótipo com <math> \Omega_s = \frac{\omega_s}{\omega_p}</math> | ||
+ | ::*Substituição de variáveis <math> p = \frac{s}{\omega_p}</math> | ||
+ | |||
+ | :*passa-baixas (<math> \Omega_p= 1 </math>) -> passa-altas (<math> \omega_p</math>) | ||
+ | ::*Cálculo do protótipo com <math> \Omega_s = \frac{\omega_p}{\omega_s}</math> | ||
+ | ::*Substituição de variáveis <math> p = \frac{\omega_p} {s}</math> | ||
+ | |||
+ | :*passa-baixas (<math> \Omega_p= 1 </math>) -> passa-faixa (<math> \omega_0 </math> e <math> B </math>) | ||
+ | ::*Cálculo do protótipo com <math> \Omega_s = \Bigg|\frac{-\omega_s^2 + \omega_0^2} {B \omega_s}\Bigg|</math> | ||
+ | ::*Substituição de variáveis <math> p = \frac{s^2 + \omega_0^2} {B s}</math> | ||
+ | :: onde <math> B = \omega_{p2} - \omega_{p1}</math> e <math> \omega_0 = \sqrt{\omega_{p2} \omega_{p1}}</math> | ||
+ | |||
+ | :*passa-baixas (<math> \Omega_p= 1 </math>) -> rejeita-faixa (<math> \omega_0 </math> e <math> B </math>) | ||
+ | ::*Cálculo do protótipo com <math> \Omega_s = \Bigg| \frac {B \omega_s} {-\omega_s^2 + \omega_0^2}\Bigg|</math> | ||
+ | ::*Substituição de variáveis <math> p = \frac {B s} {s^2 + \omega_0^2}</math> | ||
+ | :: onde <math> B = \omega_{p2} - \omega_{p1}</math> e <math> \omega_0 = \sqrt{\omega_{p2} \omega_{p1}}</math> | ||
+ | |||
+ | :* Uso das funções [http://www.mathworks.com/help/matlab/ref/semilogx.html semilogx], [http://www.mathworks.com/help/matlab/ref/semilogy.html semilogy],[http://www.mathworks.com/help/matlab/ref/logspace.html logspace], [http://www.mathworks.com/help/matlab/ref/linspace.html linspace]. | ||
+ | :*Ver em [http://www.mathworks.com/help/signal/ug/iir-filter-design.html IIR Filter Design], [http://www.mathworks.com/help/signal/ug/special-topics-in-iir-filter-design.html Special Topics in IIR Filter Design]. | ||
+ | ::*Funções para projeto do filtro protótipo analógico passa-baixas: [http://www.mathworks.com/help/signal/ref/buttap.html buttap], [http://www.mathworks.com/help/signal/ref/cheb1ap.html cheb1ap], [http://www.mathworks.com/help/signal/ref/cheb2ap.html cheb2ap], [http://www.mathworks.com/help/signal/ref/ellipap.html ellipap] | ||
+ | ::*Funções de transformação de frequencia: [http://www.mathworks.com/help/signal/ref/lp2lp.html lp2bp], [http://www.mathworks.com/help/signal/ref/lp2hp.html lp2bs], lp2hp, lp2lp | ||
+ | :*Ver pag. 208 a 218 de <ref name="SHENOI2006"/> | ||
+ | |||
+ | *Exemplos de Filtros Analógicos: | ||
+ | :* Exemplo 1: Filtro passa-baixas (<math> f_p </math> = 941Hz, <math> f_s </math> = 1209 Hz, <math> A_p </math> = 1 dB, <math> A_s </math> = 20 dB) | ||
+ | :* Exemplo 2: Filtro passa-altas (<math> f_p </math> = 1209 Hz, <math> f_s </math> = 941Hz, <math> A_p </math> = 1 dB, <math> A_s </math> = 20 dB) | ||
+ | <!--:* Exemplo 3: Filtro passa-faixa (<math> f_{p1} </math> = 811 Hz, <math> f_{p2} </math> = 895,5 Hz <math> f_{s1} </math> = 770 Hz, <math> f_{s2} </math> = 941 Hz, <math> A_p </math> = 1 dB, <math> A_r </math> = 30 dB)--> | ||
+ | :* Exemplo 3: Filtro passa-faixa (<math> f_{p1} </math> = 811 Hz, <math> f_{p2} </math> = 895,5 Hz <math> f_{s1} </math> = 770 Hz, <math> f_{s2} </math> = 1209 Hz, <math> A_p </math> = 1 dB, <math> A_r </math> = 30 dB) | ||
+ | :* Exemplo 4: Filtro rejeita-faixa (<math> f_{p1} </math> = 53 Hz, <math> f_{s1} </math> = 58 Hz, <math> f_{s2} </math> = 62 Hz <math> f_{p2} </math> = 67 Hz, <math> A_p </math> = 2 dB, <math> A_r </math> = 25 dB) | ||
+ | ::'''NOTA:''' | ||
+ | :::*No calculo do filtro lembre-se de usar as frequências angulares para <math> \omega_p </math>, <math> \omega_s </math>, <math> B\omega </math>, <math> \omega_0 </math>. | ||
+ | :::*onde <math> f_p </math> (<math> \omega_p </math>) é a frequência de passagem em Hz (rad/s), <math> f_s </math> (<math> \omega_s </math>) é a frequência de rejeição em Hz (rad/s), <math> f_0 </math> (<math> \omega_0 </math>) é a frequência central em Hz (rad/s), <math> B </math> (<math> B\omega </math>) é a largura de banda em Hz (rad/s). | ||
+ | :::*Confira os projetos dos filtros plotando as respostas em frequência dos filtros protótipo H(p) e filtro final H(s) de cada um dos exemplos. | ||
+ | |||
+ | ;Aula 15 (16 set): | ||
+ | *Filtros Digitais: Filtros IIR: transformações do tempo contínuo no tempo discreto | ||
+ | :*[[Transformação Invariante ao Impulso]] (pode ser usada apenas para filtros com forte atenuação em frequência altas, ex: passa-baixas e passa-faixa) | ||
+ | :*[[Transformação Bilinear]] (pode ser usada para todos tipos de filtro) <math> s = 2fa \frac {z-1}{z+1} </math> | ||
+ | ::*Obter a especificação do filtro em angulo entre 0 e 1, onde 1 corresponde a metade da frequência de amostragem <math> (fa/2) </math> | ||
+ | ::*Obter o valor desse angulo predistorcido <math> \lambda </math> para compensar a distorção na frequência causada pela transformação bilinear <math> \lambda= 2 tan \left (\frac{\theta \pi}{2} \right ) </math>, onde <math> \theta = \frac{f}{f_a/2} = \frac{\omega}{\omega_a /2} </math> | ||
+ | |||
+ | :*passa-baixas (<math> \Omega_p= 1 </math>) -> passa-baixas (<math> \lambda_p</math>) | ||
+ | ::*Substituição de variáveis <math> p = \frac{s}{\lambda_p}</math> | ||
+ | ::*Cálculo do protótipo com <math> \Omega_s = \frac{\lambda_s}{\lambda_p}</math> | ||
+ | |||
+ | :*passa-baixas (<math> \Omega_p= 1 </math>) -> passa-altas (<math> \lambda_p</math>) | ||
+ | ::*Substituição de variáveis <math> p = \frac{\lambda_p} {s}</math> | ||
+ | ::*Cálculo do protótipo com <math> \Omega_s = \frac{\lambda_p}{\lambda_s}</math> | ||
+ | |||
+ | :*passa-baixas (<math> \Omega_p= 1 </math>) -> passa-faixa (<math> \lambda_0 </math> e <math> B </math>) | ||
+ | ::*Substituição de variáveis <math> p = \frac{s^2 + \lambda_0^2} {B s}</math> | ||
+ | ::*Cálculo do protótipo com <math> \Omega_s = \Bigg|\frac{-\lambda_s^2 + \lambda_0^2} {B \lambda_s}\Bigg|</math> | ||
+ | :: onde <math> B = \lambda_{p2} - \lambda_{p1}</math> e <math> \lambda_0 = \sqrt{\lambda_{p2} \lambda_{p1}}</math> | ||
+ | |||
+ | :*passa-baixas (<math> \Omega_p= 1 </math>) -> rejeita-faixa (<math> \lambda_0 </math> e <math> B </math>) | ||
+ | ::*Substituição de variáveis <math> p = \frac {B s} {s^2 + \lambda_0^2}</math> | ||
+ | ::*Cálculo do protótipo com <math> \Omega_s = \Bigg| \frac {B \lambda_s} {-\lambda_s^2 + \lambda_0^2}\Bigg|</math> | ||
+ | :: onde <math> B = \lambda_{p2} - \lambda_{p1}</math> e <math> \lambda_0 = \sqrt{\lambda_{p2} \lambda_{p1}}</math> | ||
+ | ::*Ver as funções de discretização usadas no Matlab: [http://www.mathworks.com/help/signal/ref/bilinear.html bilinear], [http://www.mathworks.com/help/signal/ref/impinvar.html impinvar] | ||
+ | |||
+ | * Realizar os projetos dos exemplos anteriores, considerando uma frequência de amostragem de 8 kHz. | ||
+ | |||
+ | :*Ver pag. 219 a 229 de <ref name="SHENOI2006"/> | ||
+ | :*Ver pag. 403 a 415 e 434 a 435 de <ref name="DINIZ2014"/> | ||
+ | |||
+ | ;Aula 16 (19 set): | ||
+ | :* Ver em [http://www.mathworks.com/help/signal/ug/iir-filter-design.html IIR Filter Design] | ||
+ | :* Uso das funções [http://www.mathworks.com/help/signal/ref/buttord.html buttord], [http://www.mathworks.com/help/signal/ref/butter.html butter], [http://www.mathworks.com/help/signal/ref/cheb1ord.html cheb1ord], [http://www.mathworks.com/help/signal/ref/cheby1.html cheby1], [http://www.mathworks.com/help/signal/ref/cheb2ord.html cheb2ord], [http://www.mathworks.com/help/signal/ref/cheby2.html cheby2], [http://www.mathworks.com/help/signal/ref/ellipord.html ellipord], [http://www.mathworks.com/help/signal/ref/ellip.html ellip] para o projeto de filtros IIR digitais (sem o parâmetro ''''s''''). | ||
+ | ::O projeto dos filtros digitais IIR baseados na transformada bilinear no Matlab é realizada em dois passos: (1) Determinação da ordem do filtro; (2) Determinação dos coeficientes do numerador <math> b(n) </math> e denominador <math> a(n) </math> de <math> H(z) </math> . | ||
+ | |||
+ | :* Outros tipos de filtros IIR: [http://www.mathworks.com/help/signal/ref/yulewalk.html yulewalk], [https://www.mathworks.com/help/dsp/ref/iirnotch.html iirnotch], [https://www.mathworks.com/help/dsp/ref/iirpeak.html iirpeak], [https://www.mathworks.com/help/dsp/ref/iircomb.html iircomb], [http://www.mathworks.com/help/signal/ref/maxflat.html maxflat], [http://www.mathworks.com/help/signal/ref/invfreqz.html invfreqz] e outros filtros de [http://www.mathworks.com/help/signal/ug/parametric-modeling.html modelagem paramétrica]. | ||
+ | :* Ver funcionamento em [https://www.mathworks.com/help/signal/ug/anti-causal-zero-phase-filter-implementation.html Anti-Causal, Zero-Phase Filter Implementation]), [http://www.mathworks.com/help/signal/ref/filtfilt.html filtfilt], | ||
+ | |||
+ | <syntaxhighlight lang=matlab> | ||
+ | fa = 200; | ||
+ | fN = fa/2; | ||
+ | wo = 60/fN; bw = 10/fN; | ||
+ | [b,a] = iirnotch(wo,bw); | ||
+ | fvtool(b,a); | ||
+ | syms z; | ||
+ | N(z) = poly2sym(b,z); | ||
+ | D(z) = poly2sym(a,z); | ||
+ | H(z) = N(z)/D(z); | ||
+ | pretty(vpa(H(z),3)) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang=matlab> | ||
+ | fa = 8000; | ||
+ | fN = fa/2; | ||
+ | wo = 941/fN; bw = 100/fN; | ||
+ | [b,a] = iirpeak(wo,bw); | ||
+ | fvtool(b,a); | ||
+ | syms z; | ||
+ | N(z) = poly2sym(b,z); | ||
+ | D(z) = poly2sym(a,z); | ||
+ | H(z) = N(z)/D(z); | ||
+ | pretty(vpa(H(z),3)) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang=matlab> | ||
+ | fa = 8000; fN = fa/2; | ||
+ | fo = 1000; bw = 20/fN; | ||
+ | [b,a] = iircomb(fa/fo,bw,'peak'); % ou use a flag 'notch' | ||
+ | fvtool(b,a); | ||
+ | syms z; | ||
+ | N(z) = poly2sym(b,z); | ||
+ | D(z) = poly2sym(a,z); | ||
+ | H(z) = N(z)/D(z); | ||
+ | pretty(vpa(H(z),3)) | ||
+ | </syntaxhighlight> | ||
--> | --> | ||
{{collapse bottom}} | {{collapse bottom}} |
Edição das 10h02min de 12 de março de 2020
Registro on-line das aulas
Unidade 1
ATUAL
profile on
profile viewer Execute no Matlab o código abaixo, e analise os 3 filtros implementados através dos seus zeros e polos. Busque tirar conclusões sobre a influência da posição dos polos e zeros (ver o gráfico do plano z) e correlacione com a resposta de frequência em magnitude (gráfico do freqz).
|
Unidade 2
Unidade 2 | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b = [1 1];
a = [1 1 5];
[z1,p1,k]=tf2zp(b,a)
z2 = roots(b);
p2 = roots(a);
zplane(b,a);
%%
freqs(b,a);
%%
syms s w
H(s) = (s+1)/(s^2 + s + 5);
pretty(H(1j*w))
latex(H(1j*w))
%%
ws = logspace(-2, 1, 1000);
h = H(1j*ws);
subplot(211)
semilogx(ws,abs(h)); grid on;
subplot(212)
semilogx(ws,angle(h)/pi*180); grid on;
Os polinômios de Chebyshev de primeira ordem são definidos pela relação recursiva: Os primeiros cinco polinômios de Chebyshev de primeira ordem são:
%% Projeto de filtro passa-baixas usando funções do Matlab
%% Especificações do filtro
Wp =16000; Ws = 20000; Ap = 0.3; As = 20; G0= 3;
% Para analisar o filtro projetado, use fvtool(b,a) para observar plano s, resposta em magnitude, fase e atraso de grupo
%% Butterworth
[n,Wn] = buttord(Wp, Ws, Ap, As,'s')
[b,a] = butter(n,Wn, 's');
%% Chebyshev I
n = cheb1ord(Wp, Ws, Ap, As,'s')
[b,a] = cheby1(n,Ap, Wp, 's');
%% Chebyshev II
n = cheb2ord(Wp, Ws, Ap, As,'s')
[b,a] = cheby2(n,As, Ws, 's');
%% Elliptic - Cauer
[n, Wn] = ellipord(Wp, Ws, Ap, As,'s')
[b,a] = ellip(n,Ap,As, Wn, 's');
fa = 200;
fN = fa/2;
wo = 60/fN; bw = 10/fN;
[b,a] = iirnotch(wo,bw);
fvtool(b,a);
syms z;
N(z) = poly2sym(b,z);
D(z) = poly2sym(a,z);
H(z) = N(z)/D(z);
pretty(vpa(H(z),3))
fa = 8000;
fN = fa/2;
wo = 941/fN; bw = 100/fN;
[b,a] = iirpeak(wo,bw);
fvtool(b,a);
syms z;
N(z) = poly2sym(b,z);
D(z) = poly2sym(a,z);
H(z) = N(z)/D(z);
pretty(vpa(H(z),3))
fa = 8000; fN = fa/2;
fo = 1000; bw = 20/fN;
[b,a] = iircomb(fa/fo,bw,'peak'); % ou use a flag 'notch'
fvtool(b,a);
syms z;
N(z) = poly2sym(b,z);
D(z) = poly2sym(a,z);
H(z) = N(z)/D(z);
pretty(vpa(H(z),3))
--> |
Avaliações
- Atividades extraclasse
- AE1 - Cálculo de uma DFT de comprimento 8.
- Determine a transformada discreta de Fourier X(w) a partir da sequencia discreta x(n) indicada na tabela abaixo.
- Utilize a equação da DFT
- O algoritmo FFT indicado na tabela, onde dt é decimação no tempo (Fig 3.9) e df é decimação na frequência (Fig 3.13)
- Use uma folha de papel para anotar os valores dos produtos intermediários tanto da DFT como da FFT.
- Compare os resultados obtidos para de X(k) obtido com os dois cálculos.
- Poste no Moodle a folha de cálculos (digitalize usando scanner ou smartphone).
- Prova escrita A1
- Entrega do Projeto Final. O projeto é avaliado nos quesitos:
- PFe - Documento de Especificação (apresentado no relatório);
- PFp - Implementação do Projeto;
- PFr - Relatório do Projeto (excluído a especificação);
- PFi - Avaliação individual do aluno no projeto (conceito subjetivo atribuído pelo professor a partir da observação e da apresentação do projeto).
Referências Bibliográficas
- ↑ 1,0 1,1 1,2 DINIZ, P. S. R., DA SILVA, E. A. B., e LIMA NETTO, S. Processamento Digital de Sinais: Projeto e Análise de Sistemas. 2. ed. Porto Alegre: Bookman, 2014. 976 p. ISBN 978-8582601235
- ↑ 2,0 2,1 2,2 Erro de citação: Marca
<ref>
inválida; não foi fornecido texto para as refs chamadasSHENOI2006