[英]mathcad / matlab 3D plot of transfer function
I have a problem plotting a 3D plot of my transfer function. 我在绘制传递函数的3D图时遇到问题。 In matlab I have tryed this: 在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);
But I get this error: 但是我得到这个错误:
??? Error using ==> surf at 78
X, Y, Z, and C cannot be complex.
What could be wrong please? 请问可能有什么问题吗? Or can anyone tell me how to plot this in Mathcad? 或者有人可以告诉我如何在Mathcad中进行绘制吗? Thank you. 谢谢。
You can't plot a complex number versus two independent variables -- you would need four axes. 您无法针对两个独立变量绘制一个复数-您将需要四个轴。
What you can do is: 您可以做的是:
Use two separate figures (or two subplots in the same figure) to plot real part and imaginary part. 使用两个单独的图形(或同一图形中的两个子图)绘制实部和虚部。 In Matlab, 在Matlab中
surf(T,w,real(sys2)); figure %// create new figure for the other graph surf(T,w,imag(sys2));
Alternatively, plot absolute value and phase: 或者,绘制绝对值和相位:
surf(T,w,abs(sys2)); figure %// create new figure for the other graph surf(T,w,angle(sys2));
A more exotic possibility is to use z
axis for absolute value and colour for phase, in the same graph: 在同一张图中,更奇特的可能性是将z
轴用作绝对值,将颜色用作相位:
surf(T,w,abs(sys2),angle(sys2)); %// fourth argument of surf specifies colour
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.