Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. passband_edge = 0.2*pi;
  2. stopband_edge = 0.3*pi;
  3. passband_attenuation = 0.3;
  4. stopband_attenuation = 30;
  5. Td = 1;
  6.  
  7. % Calculating Omega = omega/Td for passband and stopband
  8. pass_frequency = passband_edge/Td;
  9. stop_frequency = stopband_edge/Td;
  10.  
  11. % getting minimum order of filter as well as cutoff-frequency
  12. [n, cf] = cheb2ord(pass_frequency, stop_frequency, passband_attenuation, stopband_attenuation, 's');
  13.  
  14. % Getting transferfunction of continous filter
  15. [b, a] = cheby2(n, stopband_attenuation, cf, 'low', 's');
  16. transferfunction = tf(b, a);
  17.  
  18. % using impulse invarianse and sampling with Td to achieve digital filter using impulse invarians
  19. [num_impulse, den_impulse] = impinvar(b, a, 1/Td);
  20. Hz_impulse = tf(num_impulse, den_impulse, 1/Td);
  21.  
  22. % getting digital filter using bilinear transform
  23. [num_bilinear, den_bilinear] = bilinear(b, a, 1/Td);
  24. Hz_bilinear = tf(num_bilinear, den_bilinear, 1/Td);
  25.  
  26. %%% Plotting filter designed using impulse invarians
  27.  
  28. freqz(num_impulse, den_impulse)
  29. freqz(num_bilinear, den_bilinear)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement