Mudanças entre as edições de "PSD29007-Engtelecom(2020-2) - Prof. Marcos Moecke"
Ir para navegação
Ir para pesquisar
Linha 192: | Linha 192: | ||
:*Ver também [http://www.mathworks.com/help/releases/R2014a/pdf_doc/matlab/index.html PDF Documentation for MATLAB]. Principalmente [http://www.mathworks.com/help/releases/R2014a/pdf_doc/matlab/getstart.pdf MATLAB Primer]. | :*Ver também [http://www.mathworks.com/help/releases/R2014a/pdf_doc/matlab/index.html PDF Documentation for MATLAB]. Principalmente [http://www.mathworks.com/help/releases/R2014a/pdf_doc/matlab/getstart.pdf MATLAB Primer]. | ||
− | |||
;Aula 7 (1 dez): | ;Aula 7 (1 dez): | ||
:* A filtragem de sinais digitais pode ser realizada de diferentes formas: | :* A filtragem de sinais digitais pode ser realizada de diferentes formas: | ||
Linha 383: | Linha 382: | ||
:*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 - Filtros IIR=== | ||
+ | {{collapse top | expand=true | Unidade 2 - Filtros IIR}} | ||
+ | ;Aula 8 (3 dez): | ||
+ | ;Conceitos Gerais sobre 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> | ||
+ | Na sequência será mostrado como inicialmente projetar o filtro LP protótipo, e depois as transformações em frequência. | ||
+ | |||
+ | * No entanto, antes de projetar filtros, vejamos a análise básica de filtros analógicos utilizando o 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> | ||
+ | %%Definição do filtro | ||
+ | |||
+ | % Definindo os coeficientes do filtro | ||
+ | b = [1 1]; % Numerador | ||
+ | a = [1 1 5]; % Denominador | ||
+ | |||
+ | % Calculando os zeros (raízes do numerador) e pólos (raízes do denominador) | ||
+ | % Método 1 - usando a função tf2zp | ||
+ | [z1,p1,k]=tf2zp(b,a) | ||
+ | % Método 2 - obtendo as raízes | ||
+ | z2 = roots(b); | ||
+ | p2 = roots(a); | ||
+ | zplane(b,a); | ||
+ | |||
+ | %% Obtendo a resposta em frequência | ||
+ | % substitituindo a variável complexa s por jw usando a função freqz | ||
+ | freqs(b,a); | ||
+ | |||
+ | % Usando cálculo simbólico e plotando o gráfico com semilogx | ||
+ | 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) | ||
+ | plot(ws,abs(h)); grid on; | ||
+ | %semilogx(ws,abs(h)); grid on; | ||
+ | subplot(212) | ||
+ | plot(ws,angle(h)/pi*180); grid on; | ||
+ | %semilogx(ws,angle(h)/pi*180); grid on; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Para aproximação de magnitude de filtros analógicos o projeto pode usar as aproximações de Butterworth, Chebyshev (tipo 1 ou 2) ou Cauer, mostradas na figura abaixo. | ||
+ | |||
+ | [[Arquivo:TiposFiltrosHs.png | 600px]] | ||
+ | |||
+ | ;Projeto de filtros analógicos do tipo Butterworth: | ||
+ | Os projetos de filtro Butterworth com função de transferência <math>H_n(s) = 1/B_n(s)</math> utilizam os polinômios de Butterworth <math>B_n(s)</math> mostrados na tabela a seguir: | ||
+ | {| | ||
+ | |----- | ||
+ | | | ||
+ | {| 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> | ||
+ | |} | ||
+ | |} | ||
+ | |||
+ | ;Proposta de exercício: | ||
+ | *Use os polinômios de Butterworth com ordens de 1 a 10 mostrados na tabela abaixo para obter os filtros . | ||
+ | *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 10 e 11 (26 e 30 mar): | ||
+ | ;Projeto de filtros analógicos LP protótipo: | ||
+ | * 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. | ||
+ | |||
+ | ;Casos em que o ganho na banda de passagem é <math> A_p = 3 dB </math>: | ||
+ | *Considerando o caso de filtro Butterworth com frequência de passagem <math> {\Omega_p} </math> e frequência de stopband (rejeição) de <math> \Omega_s </math>, com ganho unitário em <math> {\Omega = 0} </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>. | ||
+ | |||
+ | *Obtemos o fator <math> \epsilon^2 = {10^{0.1A_p}-1}</math>, ou <math> \epsilon = \sqrt{10^{0.1A_p}-1}</math>, para <math> A_p = 3 dB </math> temos que <math> \epsilon = 1 </math>. Esse fator no caso dos filtros com essa atenuação <math> A_p = 3 dB </math> acaba desaparecendo das equação de projeto. Para atenuações diferentes de 3 dB, ele ajusta a magnitude dos pólos, e afeta a ordem do filtro. | ||
+ | |||
+ | *Os passos para projetar um filtro analógico Hs(s) são: | ||
+ | :0) fazer a normalização da frequência e do ganho. | ||
+ | ::<math> {\Omega_p} = 1 </math>, e <math> \Omega_s = \frac {\omega_s} {\omega_p} </math> para o caso de filtros LP. | ||
+ | ::<math> A_p = -(G_p - G_0) </math>, <math> A_s = -(G_s - G_0) </math>. | ||
+ | |||
+ | :1) determinar a ordem <math> n </math> do filtro utilizando a equação: | ||
+ | |||
+ | ::<math> n \ge \frac {\log(10^{0.1A_s}-1)} {2 \log \Omega_s} </math> | ||
+ | |||
+ | :2) e em seguida 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) Com os pólos <math> p_k </math> botem-se o denominador <math> D(p)=\prod_{k=1}^{n} \left ( p-p_{k} \right ) </math> da função de transferência do filtro. | ||
+ | |||
+ | :4) E assim obtém-se a função de transferência do filtro protótipo <math> H(p)= \frac{1}{D(p)} </math> | ||
+ | |||
+ | :5) Para obter a função de transferência do filtro analógico LP é necessário fazer uma 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> | ||
+ | |||
+ | :6) Se o ganho na frequência <math> {\omega = 0} </math> não for unitário G0, é ainda necessário ajustar o ganho do filtro do fator de ganho. Considerando que o valor do Ganho G0 seja dado em dB, teremos que <math> 20*log10(G_{0(linear)}) = G_{0(dB)} </math>, ou seja <math> G_{0(linear)} = 10^{G_{0(dB)}/20} </math> | ||
+ | |||
+ | {{collapse top| bg=lightyellow | Exemplo Filtro LP Butterworth}} | ||
+ | |||
+ | Projete um filtro Butterworth LP com ganho em <math> \omega = 0 </math> <math> G_{topo} = 5 dB </math>, frequência de passagem <math> {\omega_p} = 1000 rad/s </math> com ganho no mínimo de <math> G_p = 2 dB </math>, frequência de rejeição de <math> \omega_s = 5000 rad/s </math>, na qual o ganho deve ser inferior a <math> G_s = -25 dB </math> dB. | ||
+ | *Dados de <math> Hs(s) </math>, passa-baixas (lowpass-LP) | ||
+ | ::<math> \omega_p = </math> | ||
+ | ::<math> \omega_s = </math> | ||
+ | ::<math> G_{topo(dB)} = </math> | ||
+ | ::<math> G_{p(dB)} = </math> | ||
+ | ::<math> G_{s(dB)} = </math> | ||
+ | |||
+ | *Especificações de <math> Hp(p) </math>, passa-baixas (lowpass-LP) protótipo | ||
+ | ::<math> \Omega_p = </math> | ||
+ | ::<math> \Omega_s = </math> | ||
+ | ::<math> A_{0(dB)} = </math> | ||
+ | ::<math> A_{p(dB)} = </math> | ||
+ | ::<math> A_{s(dB)} = </math> | ||
+ | |||
+ | *Determinação de <math> Hp(p) </math> | ||
+ | ::<math> \epsilon = </math> | ||
+ | ::<math> n = </math> | ||
+ | ::<math> p_k = </math> | ||
+ | ::<math> D(p) = </math> | ||
+ | ::<math> Hp(p) = </math> | ||
+ | |||
+ | *Determinação de <math> Hs1(s) </math> substituindo <math>p=\frac{s}{\omega_p}</math> e corrigindo o ganho em <math> G_{topo} </math> | ||
+ | ::<math> Hs2(s) = Hs1(s) \cdot 10^{G_{topo}/20}</math> | ||
+ | |||
+ | *Obtida a função de transferência <math> Hs(s) = N(s)/D(s)</math> obtenha a resposta em frequência, substituindo <math>s=j*\omega</math> | ||
+ | |||
+ | *Obtenha a resposta em frequência, para <math>\omega = 0, \omega_p , \omega_s, 10\omega_p </math> | ||
+ | |||
+ | *Plote o gráfico de <math> |Hp(p)| </math> e <math> |Hs(s)| </math>, indicando a máscara de especificação do filtro. | ||
+ | |||
+ | {{collapse bottom}} | ||
+ | |||
+ | |||
+ | ;Aula 12 (2 abr): | ||
+ | ;Casos em que o ganho na banda de passagem é um valor <math> A_p </math> qualquer: | ||
+ | |||
+ | *Teremos <math> \epsilon = \sqrt{10^{0.1A_p}-1}</math>, ou <math> \epsilon^2 = (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>. | ||
+ | |||
+ | :4) 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> | ||
+ | {{collapse top| bg=lightyellow | Exemplo Filtro LP Butterworth}} | ||
+ | |||
+ | Projete um filtro Butterworth LP com ganho em <math> \omega = 0 </math> <math> G_{topo} = 0dB </math>, frequência de passagem <math> {\omega_p} = 1000 rad/s </math> com atenuação máxima de <math> A_p = 0.5 dB </math>, frequência de rejeição de <math> \omega_s = 5000 rad/s </math> com atenuação mínima de <math> A_s = 30 dB </math>. | ||
+ | |||
+ | *Dados de <math> Hs(s) </math>, passa-baixas (lowpass-LP) | ||
+ | ::<math> \omega_p = </math> | ||
+ | ::<math> \omega_s = </math> | ||
+ | ::<math> G_{topo(dB)} = </math> | ||
+ | ::<math> G_{p(dB)} = </math> | ||
+ | ::<math> G_{s(dB)} = </math> | ||
+ | |||
+ | *Especificações de <math> Hp(p) </math>, passa-baixas (lowpass-LP) protótipo | ||
+ | ::<math> \Omega_p = </math> | ||
+ | ::<math> \Omega_s = </math> | ||
+ | ::<math> G_{0(dB)} = </math> | ||
+ | ::<math> A_{p(dB)} = </math> | ||
+ | ::<math> A_{s(dB)} = </math> | ||
+ | |||
+ | *Determinação de <math> Hp(p) </math> | ||
+ | ::<math> \epsilon = </math> | ||
+ | ::<math> n = </math> | ||
+ | ::<math> p_k = </math> | ||
+ | ::<math> D(p) = </math> | ||
+ | ::<math> Hp(p) = </math> | ||
+ | |||
+ | *Determinação de <math> Hs1(s) </math> substituindo <math>p=\frac{s}{\omega_p}</math> e corrigindo o ganho em <math> G_{topo} </math> | ||
+ | ::<math> Hs2(s) = Hs1(s) \cdot 10^{G_{topo}/20}</math> | ||
+ | |||
+ | *Obtida a função de transferência <math> Hs(s) = N(s)/D(s)</math> obtenha a resposta em frequência, substituindo <math>s=j*\omega</math> | ||
+ | |||
+ | *Obtenha a resposta em frequência, para <math>\omega = 0, \omega_p , \omega_s, 10\omega_p </math> | ||
+ | |||
+ | *Plote o gráfico de <math> |Hp(p)| </math> e <math> |Hs(s)| </math>, indicando a máscara de especificação do filtro. | ||
+ | {{collapse bottom}} | ||
+ | |||
+ | :*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> | ||
+ | ;Aula 13 (6 abr): | ||
+ | |||
+ | ; Polinômios Chebyshev de primeira ordem: | ||
+ | Para o projeto dos filtros do tipo Chebyshev, são utilizados os polinômios de Chebyshev de primeira ordem, os quais são definidos pela equação trigonométrica: | ||
+ | :<math>C_n(\Omega) = cos (n cos^{-1}(\Omega))</math> | ||
+ | Os dois primeiros polinômios são facilmente calculados como: | ||
+ | :<math>C_0(\Omega) = cos (0 \times cos^{-1}(\Omega)) = cos(0) = 1 </math> | ||
+ | :<math>C_1(\Omega) = cos (1 \times cos^{-1}(\Omega)) = \Omega </math> | ||
+ | |||
+ | O cálculo dos demais termos pode ser feita pela relação recursiva: | ||
+ | :<math>C_{n}(\Omega) = 2 \times \Omega \times C_{n-1}(\Omega) - C_{n-2}(\Omega)</math> | ||
+ | Portanto o polinômio de grau 2 pode ser obtido por | ||
+ | :<math>C_{2}(\Omega) = 2 \times \Omega \times C_{1}(\Omega) - C_{0}(\Omega) </math> | ||
+ | :<math>C_{2}(\Omega) = 2 \times \Omega \times \Omega - 1 </math> | ||
+ | :<math>C_{2}(\Omega) = 2 \Omega ^2 - 1 </math> | ||
+ | |||
+ | Assim os primeiros nove polinômios de Chebyshev de primeira ordem podem ser obtidos: | ||
+ | :<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> | ||
+ | :<math> C_6(\Omega) = 32\Omega^6 - 48\Omega^4 + 18\Omega^2 - 1 \,</math> | ||
+ | :<math> C_7(\Omega) = 64\Omega^7 - 112\Omega^5 + 56\Omega^3 - 7\Omega \,</math> | ||
+ | :<math> C_8(\Omega) = 128\Omega^8 - 256\Omega^6 + 160\Omega^4 - 32\Omega^2 + 1 \,</math> | ||
+ | |||
+ | Esses polinômios mostram um comportamento oscilatório entre <math> -1 < \Omega < 1 </math>. | ||
+ | <center> | ||
+ | :[[Arquivo:ChebyshevGraph.png| 600px]] | ||
+ | :Figura: Os primeiros cinco polinômios de Chebyshev de primeira ordem no domínio <math> -1 < \Omega < 1 </math> | ||
+ | FONTE: [https://pt.wikipedia.org/wiki/Polin%C3%B4mios_de_Tchebychev Polinômios de Tchebychev], Wikipedia | ||
+ | </center> | ||
+ | *Ver mais em [[Polinômio de Chebyshev]] | ||
+ | |||
+ | ; Projeto de filtro protótipo LP do tipo Chebyshev I: | ||
+ | *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> \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)/ \epsilon^2}} {\cosh^{-1} \Omega_s} </math> | ||
+ | ::onde <math> \epsilon^2 = (10^{0.1A_p}-1)</math> ou <math> \epsilon = \sqrt{10^{0.1A_p}-1 } </math>. | ||
+ | |||
+ | *Obtenha 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> e <math> \varphi_2 = \frac{1}{n} \sinh^{-1}\left (\frac{1}{\epsilon} \right ) </math> | ||
+ | |||
+ | |||
+ | <!-- ou seja :<math> 10 log10 \left| H( 1 ) \right | = sqrt(\frac {1}{1+\epsilon^2}) </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{H_0}{D(p)} </math>, onde <math> D(p)=\prod_{k-1}^{n} \left ( p-p_{k} \right ) </math> | ||
+ | |||
+ | ::onde | ||
+ | ::<math>H_0 = H(0) \times d_0 =\left\{ | ||
+ | \begin{matrix} | ||
+ | d_0 & \text{para} & n & \text{impar} \\ | ||
+ | \frac {d_0}{\sqrt[]{1+\epsilon^2}} & \text{para} & n & \text{par} | ||
+ | \end{matrix}\right. </math> | ||
+ | ::<math> d_0 =\prod_{k-1}^{n} \left (-p_{k} \right ) </math> é o último termo do denominador <math> D(p) = d_n p^n+ d_{n-1} p^{n-1} + \cdots + d_1 p+ d_0 </math> | ||
+ | |||
+ | ::<math>\left | H( 0 ) \right | ^2 = \left\{ | ||
+ | \begin{matrix} | ||
+ | 1 & \text{para} & n & \text{impar} \\ | ||
+ | \frac {1}{1+\epsilon^2} & \text{para} & n & \text{par} | ||
+ | \end{matrix}\right. </math> | ||
+ | |||
+ | |||
+ | ::<math>\left | H( 1 ) \right | ^2 = \frac {1}{1+\epsilon^2} </math>, onde <math> 20 log10 (\left | H( 1 ) \right |) = A_p (dB) </math> | ||
+ | |||
+ | ; Projeto de Filtros Analógicos do tipo LP, HP, BP, BS: | ||
+ | Para o projeto de filtros analógicos é necessário fazer as transformações de frequência indicadas abaixo, as quais devem ser consideradas no momento da determinação dos parâmetros do filtro protótipo LP. | ||
+ | :* 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> | ||
+ | |||
+ | ;Aula 14 (9 abr): | ||
+ | {{collapse top| bg=lightyellow | Exemplo Filtro HP Chebyshev I}} | ||
+ | |||
+ | Projete um filtro Chebyshev I '''HP''' com ganho em <math> \omega = 0 </math> <math> G_{topo} = 5 dB</math>, frequência de rejeição <math> {\omega_s} = 2500 rad/s </math> com atenuação mínima de <math> A_s = 30 dB </math>, frequência de passagem de <math> \omega_p = 12500 rad/s </math> com atenuação máxima de <math> A_p = 0.5 dB </math>. | ||
+ | |||
+ | *Dados de <math> Hs(s)</math>, passa-altas (highpass-HP) | ||
+ | ::<math> \omega_p = </math> | ||
+ | ::<math> \omega_s = </math> | ||
+ | ::<math> G_{topo(dB)} = </math> | ||
+ | ::<math> G_{p(dB)} = </math> | ||
+ | ::<math> G_{s(dB)} = </math> | ||
+ | |||
+ | *Especificações de <math> Hp(p) </math>, passa-baixas (lowpass-LP) protótipo | ||
+ | ::<math> \Omega_p = </math> | ||
+ | ::<math> \Omega_s = </math> | ||
+ | ::<math> A_{0(dB)} = </math> | ||
+ | ::<math> A_{p(dB)} = </math> | ||
+ | ::<math> A_{s(dB)} = </math> | ||
+ | |||
+ | *Determinação de <math> Hp(p) </math> | ||
+ | ::<math> \epsilon = </math> | ||
+ | ::<math> n = </math> | ||
+ | ::<math> p_k = </math> | ||
+ | ::<math> D(p) = </math> | ||
+ | ::<math> d_0 = </math> | ||
+ | ::<math> H_0 = </math> | ||
+ | ::<math> Hp(p) = </math> | ||
+ | |||
+ | *Determinação de <math> Hs1(s) </math> '''HP''' substituindo <math>p=\frac{\omega_p}{s}</math> e corrigindo o ganho em <math> G_{topo} </math> | ||
+ | ::<math> Hs2(s) = Hs1(s) \cdot 10^{G_{topo}/20}</math> | ||
+ | |||
+ | *Obtida a função de transferência <math> Hs(s) = N(s)/D(s)</math> obtenha a resposta em frequência, substituindo <math>s=j*\omega</math> | ||
+ | |||
+ | *Obtenha a resposta em frequência, para <math>\omega = 0, \omega_p , \omega_s, 10\omega_p </math> | ||
+ | |||
+ | *Plote o gráfico de <math> |Hp(p)| </math> e <math> |Hs(s)| </math>, indicando a máscara de especificação do filtro. | ||
+ | {{collapse bottom}} | ||
+ | |||
+ | ;Aula 15 (13 abr): | ||
+ | |||
+ | * 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''''). | ||
+ | |||
+ | *'''[n,Wn] = buttord(Wp,Ws,Rp,Rs,'s')''' Encontra a menor ordem '''n''' é a frequência de corte '''Wn''' para um filtro Butterworth analógico, com ripple na banda passante (''bandpass'') menor que '''Rp''' dB e atenuação na banda de rejeição (''stopband'') pelo menos de '''Rs''' dB. As frequências angulares '''Wp''' e '''Ws''' são dadas em rad/s. Se Wp e Ws são escalares, o filtro será um LP ou HP. Se Wp e Ws forem vetores, o filtro será um BP ou BS. | ||
+ | |||
+ | *'''[b,a] = butter(n,Wn,ftype,'s')''' Projeta o filtro Butterworth analógico LP, HP, BP ou BS com frequência angular de corte '''Wn''', dependendo do valor de '''ftype''' e do número de elementos de '''Wn'''. | ||
+ | <syntaxhighlight lang=matlab> | ||
+ | %% Projeto de filtro passa-alta (HP) usando funções do Matlab | ||
+ | Wp = 150; % rad/s | ||
+ | Ws = 40; % rad/s | ||
+ | Rp = 3; % dB | ||
+ | Rs = 60; % dB | ||
+ | [n,Wn] = buttord(Wp,Ws,Rp,Rs,'s') | ||
+ | [b,a] = butter(n,Wn,'high','s'); | ||
+ | [h,w] = freqs(b,a,logspace(1,3,1000)); | ||
+ | semilogx(w,20*log10(abs(h)));grid on; | ||
+ | hold on; plot([Wp Wn Ws],[-Rp -3 -Rs],'x'); hold off; | ||
+ | title(sprintf('Filtro HP Butterworth, n = %d',n)) | ||
+ | |||
+ | %% Projeto de filtro passa-faixa (BP) usando funções do Matlab | ||
+ | Wp = [100 200]; % rad/s | ||
+ | Ws = [50 250]; % rad/s | ||
+ | Rp = 3; % dB | ||
+ | Rs = 40; % dB | ||
+ | [n,Wn] = buttord(Wp,Ws,Rp,Rs,'s'); | ||
+ | [b,a] = butter(n,Wn,'s'); | ||
+ | freqs(b,a,logspace(1,3,1000)) | ||
+ | title(sprintf('Filtro BP Butterworth, n = %d',n)) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | *'''[n,Wp] = cheb1ord(Wp,Ws,Rp,Rs,'s')''' designs a lowpass, highpass, bandpass, or bandstop analog Chebyshev Type I filter with cutoff angular frequencies Wp. | ||
+ | *'''[b,a] = cheby1(n,Rp,Wp,ftype,'s')''' designs a lowpass, highpass, bandpass, or bandstop analog Chebyshev Type I filter with passband edge angular frequency Wp and Rp decibels of passband ripple. | ||
+ | |||
+ | *'''[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs,'s')''' designs a lowpass, highpass, bandpass, or bandstop analog Chebyshev Type II filter with cutoff angular frequencies Ws. | ||
+ | *'''[b,a] = cheby2(n,Rs,Ws,ftype,'s')''' designs a lowpass, highpass, bandpass, or bandstop analog Chebyshev Type II filter with stopband edge angular frequency Ws and Rs decibels of stopband attenuation. | ||
+ | |||
+ | *'''[n,Wn] = ellipord(Wp,Ws,Rp,Rs,'s'''') finds the minimum order n and cutoff frequencies Wn for an analog elliptic filter. Specify the frequencies Wp and Ws in radians per second. The passband or the stopband can be infinite. | ||
+ | *'''[b,a] = ellip(n,Rp,Rs,Wp,ftype, 's'''') designs a lowpass, highpass, bandpass, or bandstop analog elliptic filter with passband edge angular frequency Wp, Rp decibels of passband ripple, and Rs decibels of stopband attenuation. | ||
+ | |||
+ | *Note: The resulting bandpass and bandstop designs are of order 2n. | ||
+ | *Note: See [https://www.mathworks.com/help/signal/ref/cheby1.html#bucqqye-2 Limitations] [https://www.mathworks.com/help/signal/ref/ellip.html#bucsbss-2] for information about numerical issues that affect forming the transfer function. | ||
+ | |||
+ | :* Ver também [https://www.mathworks.com/help/signal/ug/comparison-of-analog-iir-lowpass-filters.html Comparison of Analog IIR Lowpass Filters]. | ||
+ | :* Uso das funções [http://www.mathworks.com/help/signal/ref/freqs.html freqs], [https://www.mathworks.com/help/signal/ref/zplane.html zplane] 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 16 (16 abr): | ||
+ | |||
+ | *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_{s1} </math> = 770 Hz, <math> f_{p1} </math> = 811 Hz, <math> f_{p2} </math> = 895,5 Hz, <math> f_{s2} </math> = 1209 Hz, <math> A_p </math> = 1 dB, <math> A_s </math> = 30 dB, <math> G_{topo} </math> = 5 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_s </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. | ||
+ | |||
+ | :* Comparar o uso das funções [http://www.mathworks.com/help/matlab/ref/plot.html plot], [http://www.mathworks.com/help/matlab/ref/stem.html stem], [http://www.mathworks.com/help/matlab/ref/fplot.html fplot], [http://www.mathworks.com/help/matlab/ref/semilogx.html semilogx], [http://www.mathworks.com/help/matlab/ref/semilogy.html semilogy]. | ||
+ | :* Estudar as funções auxiliares [http://www.mathworks.com/help/matlab/ref/logspace.html logspace], [http://www.mathworks.com/help/matlab/ref/linspace.html linspace], [http://www.mathworks.com/help/matlab/ref/hold.html hold], [http://www.mathworks.com/help/matlab/ref/grid.html grid], [http://www.mathworks.com/help/matlab/ref/subplot.html subplot], [http://www.mathworks.com/help/matlab/ref/legend.html legend], [http://www.mathworks.com/help/matlab/ref/xlabel.html xlabel], [http://www.mathworks.com/help/matlab/ref/ylabel.html ylabel], [http://www.mathworks.com/help/matlab/ref/title.html title], [http://www.mathworks.com/help/matlab/ref/text.html text]. | ||
+ | :*Funções de transformação de frequência: [http://www.mathworks.com/help/signal/ref/lp2lp.html lp2lp], [http://www.mathworks.com/help/signal/ref/lp2hp.html lp2hp],[http://www.mathworks.com/help/signal/ref/lp2bp.html lp2bp], [http://www.mathworks.com/help/signal/ref/lp2bs.html lp2bs]. | ||
+ | :*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]. | ||
+ | :*Ver pag. 208 a 218 de <ref name="SHENOI2006"/> | ||
+ | |||
+ | ;Aula 17 e 18 (23 e 28 abr): | ||
+ | |||
+ | *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 <math> \theta </math> entre 0 e 1, onde 1 corresponde a metade da frequência de amostragem <math> (fa/2) </math>, ou também o angulo <math> \pi </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"/> | ||
+ | :*Ver também a ferramenta [http://www.mathworks.com/help/signal/ref/fvtool.html fvtool], que facilita a análise dos filtros digitais. | ||
+ | |||
+ | {{collapse top| bg=lightyellow | Exemplo filtro digital BP IIR - transformação bilinear}} | ||
+ | |||
+ | Projete um filtro digital passa-banda IIR com <math> G_{topo} = 5 dB </math>, frequências de passagem <math> f_{p1} = 811 Hz </math> e <math> f_{p2} = 895,5 Hz </math> com ganho no mínimo de <math> G_p = 2 dB </math>, frequências de rejeição de <math> f_{s1} = 770 Hz </math> e <math> f_{s1} = 1209 Hz </math>, na qual o ganho deve ser inferior a <math> G_s = -25 dB </math> dB. Considere dois projetos para uma frequência de amostragem <math> f_{a1} = 4000 Hz </math> e também para <math> f_{a2} = 8000 Hz </math>. | ||
+ | |||
+ | *Dados de especificação do filtro passa-banda (band-pass - BP) | ||
+ | ::<math> f_{a} = </math> | ||
+ | ::<math> f_{s1} = </math> | ||
+ | ::<math> f_{p1} = </math> | ||
+ | ::<math> f_{p2} = </math> | ||
+ | ::<math> f_{s2} = </math> | ||
+ | ::<math> G_{topo(dB)} = </math> | ||
+ | ::<math> G_{p(dB)} = </math> | ||
+ | ::<math> G_{s(dB)} = </math> | ||
+ | |||
+ | *Dados do filtro digital <math> Hz(z) </math>, passa-banda (band-pass - BP) | ||
+ | ::<math> \theta_{s1} = </math> | ||
+ | ::<math> \theta_{p1} = </math> | ||
+ | ::<math> \theta_{p2} = </math> | ||
+ | ::<math> \theta_{s2} = </math> | ||
+ | ::<math> G_{topo(dB)} = </math> | ||
+ | ::<math> G_{p(dB)} = </math> | ||
+ | ::<math> G_{s(dB)} = </math> | ||
+ | |||
+ | *Dados do filtro analógico <math> Hs(s) </math>, passa-banda (band-pass - BP) | ||
+ | ::<math> \lambda_{s1} = </math> | ||
+ | ::<math> \lambda_{p1} = </math> | ||
+ | ::<math> \lambda_{p2} = </math> | ||
+ | ::<math> \lambda_{s2} = </math> | ||
+ | ::<math> \lambda_{0} = </math> | ||
+ | ::<math> B\lambda = </math> | ||
+ | ::<math> G_{topo(dB)} = </math> | ||
+ | ::<math> G_{p(dB)} = </math> | ||
+ | ::<math> G_{s(dB)} = </math> | ||
+ | |||
+ | *Especificações de <math> Hp(p) </math>, passa-baixas (lowpass-LP) protótipo | ||
+ | ::<math> \Omega_p = 1 </math> | ||
+ | ::<math> \Omega_s = </math> | ||
+ | ::<math> A_{0(dB)} = 0 </math> | ||
+ | ::<math> A_{p(dB)} = </math> | ||
+ | ::<math> A_{s(dB)} = </math> | ||
+ | |||
+ | *Determinação de <math> Hp(p) </math> | ||
+ | ::<math> n = </math> | ||
+ | ::<math> p_k = </math> | ||
+ | ::<math> z_k = </math> | ||
+ | ::<math> Dp(p) = </math> | ||
+ | ::<math> Np(p) = </math> | ||
+ | ::<math> Hp(p) = </math> | ||
+ | |||
+ | *Determinação de <math> Hs1(s) </math> substituindo <math>p=\frac{s}{\omega_p}</math> e corrigindo o ganho em <math> G_{topo} </math> | ||
+ | ::<math> Hs2(s) = Hs1(s) \cdot 10^{G_{topo}/20}</math> | ||
+ | |||
+ | *Obtida a função de transferência <math> Hs(s) = N(s)/D(s)</math> obtenha a resposta em frequência, substituindo <math>s=j*\omega</math> | ||
+ | |||
+ | *Determinação de <math> Hz(z) </math> substituindo <math>s=2\frac{s - 1}{s + 1}</math> | ||
+ | |||
+ | *Plote o gráfico de <math> |Hp(p)| </math>, <math> |Hs(s)| </math> e <math> |Hz(z)| </math>, indicando a máscara de especificação do filtro. | ||
+ | <center> [[Arquivo:IIRCheb2BP.png|800px]]</center> | ||
+ | {{collapse bottom}} | ||
+ | |||
+ | |||
+ | ;Aula 19 (30 abr): | ||
+ | :* 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 15h40min de 3 de dezembro de 2020
Unidade 1
Unidade 1 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
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 - Filtros IIR
Unidade 2 - Filtros IIR | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Na sequência será mostrado como inicialmente projetar o filtro LP protótipo, e depois as transformações em frequência.
%%Definição do filtro
% Definindo os coeficientes do filtro
b = [1 1]; % Numerador
a = [1 1 5]; % Denominador
% Calculando os zeros (raízes do numerador) e pólos (raízes do denominador)
% Método 1 - usando a função tf2zp
[z1,p1,k]=tf2zp(b,a)
% Método 2 - obtendo as raízes
z2 = roots(b);
p2 = roots(a);
zplane(b,a);
%% Obtendo a resposta em frequência
% substitituindo a variável complexa s por jw usando a função freqz
freqs(b,a);
% Usando cálculo simbólico e plotando o gráfico com semilogx
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)
plot(ws,abs(h)); grid on;
%semilogx(ws,abs(h)); grid on;
subplot(212)
plot(ws,angle(h)/pi*180); grid on;
%semilogx(ws,angle(h)/pi*180); grid on;
Os projetos de filtro Butterworth com função de transferência utilizam os polinômios de Butterworth mostrados na tabela a seguir:
|