mathcadmatlab传递函数的三维绘图



我在绘制传递函数的三维图时遇到问题。在matlab中,我尝试过这个:

 [T,w] = meshgrid(1:1:32,1:1:100);
sys2=20*log((1-w.*(T./2)./w.*T).*(((2.56.*(w.^2)+1.6.*w+1)./(0.0008.*(w.^6)+0.0124.* (w.^5)+0.173.*(w.^4)+(w.^3)))./1+(((2.56.*(w.^2)+1.6.*w+1)./(0.0008.*(w.^6)+0.0124.*(w.^5)+0.173.*(w.^4)+(w.^3))))));
 surf(T,w,sys2);

但我得到了这个错误:

  ??? Error using ==> surf at 78
  X, Y, Z, and C cannot be complex.

请问可能出了什么问题?或者有人能告诉我如何在Mathcad中绘制这个吗?非常感谢。

您不能绘制一个复数与两个自变量的关系图——您需要四个轴。

你能做的是:

  1. 使用两个单独的图形(或同一图形中的两个子图形)绘制真实部分和想象部分。在Matlab中,

    surf(T,w,real(sys2));
    figure %// create new figure for the other graph
    surf(T,w,imag(sys2));
    
  2. 或者,绘制绝对值和相位:

    surf(T,w,abs(sys2));
    figure %// create new figure for the other graph
    surf(T,w,angle(sys2));
    
  3. 在同一张图中,一种更奇特的可能性是使用z轴作为绝对值,使用颜色作为相位:

    surf(T,w,abs(sys2),angle(sys2)); %// fourth argument of surf specifies colour
    

最新更新