[未答复] 二阶低通滤波推导的公式波特图与预期不符

[复制链接]
zengxy3407 发表于 2022-3-29 22:43:11
本帖最后由 zengxy3407 于 2022-3-29 23:00 编辑

求助各位路过的大神,我在推导二阶低通滤波的差分方程时碰到以下问题求解答:
大家都知道,二阶低通滤波器的标准传递函数如下:


用反向差分法离散化,代入反向差分公式:


然后简化,过程如下:





上下同乘以z^2:



然后用MATLAB画bode图验证:

  1. fs = 16000;
  2. fc = 5000;
  3. xi = 1/sqrt(2);

  4. omgc = fc * 2 * pi;
  5. T = 1/fs;
  6. omgcT = omgc * T;

  7. a2 = 1 + 2 * xi * omgcT + omgcT * omgcT;
  8. a1 = -(2 + 2 * xi *omgcT);
  9. a0 = 1;
  10. b2 = omgcT * omgcT;
  11. b1 = 0;
  12. b0 = 0;


  13. N = [b2 b1 b0]
  14. D = [a2 a1 a0]

  15. sys = tf(N, D, T)

  16. bode(sys)
  17. hold on

  18. sysc = tf([omgc*omgc], [1 2*xi*omgc, omgc*omgc])
  19. bode(sysc)
  20. sysd = c2d(sysc, T)
  21. bode(sysd)
复制代码



得到的结果跟MATLAB计算的不一样:

  1. N =

  2.     3.8553         0         0


  3. D =

  4.     7.6321   -4.7768    1.0000


  5. sys =

  6.          3.855 z^2
  7.   -----------------------
  8.   7.632 z^2 - 4.777 z + 1

  9. Sample time: 6.25e-05 seconds
  10. Discrete-time transfer function.


  11. sysc =

  12.            9.87e08
  13.   --------------------------
  14.   s^2 + 4.443e04 s + 9.87e08

  15. Continuous-time transfer function.


  16. sysd =

  17.      0.7094 z + 0.2623
  18.   ------------------------
  19.   z^2 - 0.0905 z + 0.06224

  20. Sample time: 6.25e-05 seconds
  21. Discrete-time transfer function.

复制代码



得到的波特图也完全不对,连截止频率都差很多,这是为什么?

00d3fe66-5c99-459a-89fa-cd5334ae9503.png

我还试了一下Matlab的zoh,得到的结果如下:

  1. >> sysc = tf([1],[1,0])

  2. sysc =

  3.   1
  4.   -
  5.   s

  6. Continuous-time transfer function.

  7. >> sysd = c2d(sysc, 0.1)

  8. sysd =

  9.    0.1
  10.   -----
  11.   z - 1

  12. Sample time: 0.1 seconds
  13. Discrete-time transfer function.
复制代码



其实就是前向差分法,, 我用同样的方法试了也不对:






  1. clear

  2. fs = 16000;
  3. fc = 5000;
  4. xi = 1/sqrt(2);

  5. omgc = fc * 2 * pi;
  6. T = 1/fs;
  7. omgcT = omgc * T;


  8. %---------continous system-----------------------
  9. sysc = tf([omgc*omgc], [1 2*xi*omgc, omgc*omgc])
  10. bode(sysc)
  11. hold on

  12. %--------coeff of backward diff method------------------
  13. a2 = 1 + 2 * xi * omgcT + omgcT * omgcT;
  14. a1 = -(2 + 2 * xi *omgcT);
  15. a0 = 1;
  16. b2 = omgcT * omgcT;
  17. b1 = 0;
  18. b0 = 0;


  19. N = [b2 b1 b0]
  20. D = [a2 a1 a0]

  21. sysd_backdiff = tf(N, D, T)
  22. bode(sysd_backdiff)
  23. %-------------------------------------------------


  24. %--------coeff of forward diff method (zoh)------------------
  25. a0 = 1 - 2 * xi * omgcT + omgcT * omgcT;
  26. a1 = -(2 - 2 * xi *omgcT);
  27. a2 = 1;
  28. b0 = omgcT * omgcT;
  29. b1 = 0;
  30. b2 = 0;


  31. N = [b2 b1 b0]
  32. D = [a2 a1 a0]

  33. sysd_forediff = tf(N, D, T)
  34. bode(sysd_forediff)
  35. %-------------------------------------------------

  36. %---------zoh from continous system-----------------
  37. sysd_zoh = c2d(sysc, T)
  38. bode(sysd_zoh)
  39. %--------------------------------------------------

  40. grid on
复制代码


  1. sysc =

  2.            9.87e08
  3.   --------------------------
  4.   s^2 + 4.443e04 s + 9.87e08

  5. Continuous-time transfer function.


  6. N =

  7.     3.8553         0         0


  8. D =

  9.     7.6321   -4.7768    1.0000


  10. sysd_backdiff =

  11.          3.855 z^2
  12.   -----------------------
  13.   7.632 z^2 - 4.777 z + 1

  14. Sample time: 6.25e-05 seconds
  15. Discrete-time transfer function.


  16. N =

  17.          0         0    3.8553


  18. D =

  19.     1.0000    0.7768    2.0785


  20. sysd_forediff =

  21.           3.855
  22.   ----------------------
  23.   z^2 + 0.7768 z + 2.079

  24. Sample time: 6.25e-05 seconds
  25. Discrete-time transfer function.


  26. sysd_zoh =

  27.      0.7094 z + 0.2623
  28.   ------------------------
  29.   z^2 - 0.0905 z + 0.06224

  30. Sample time: 6.25e-05 seconds
  31. Discrete-time transfer function.
复制代码
就错得更离谱了,连增益都变成正的了:
2022-03-29.png

求各位大神赐教!!




捕获2.JPG
捕获1.JPG
您需要登录后才可以回帖 登录 | 注册

本版积分规则

相关帖子
相关文章
热门教程
站长推荐
快速回复 返回顶部 返回列表