如何实现两个变量区间的分段函数呢。
显示 更早的评论
x=-2:0.01:2;
x=x+(x==0)*eps;
y=-2:0.01:2;
%y=y+(y==0)*eps;
[X,Y]=meshgrid(x,y);
m=1;
for xx=x,yy=Y
if(xx<=2&xx>0&&yy<=2&yy>0)
B=Y./X;
elseif(xx>=-2&xx<0&&yy<=2&yy>0)
B=Y./X+pi/2;
elseif(xx>=-2&xx<0&&yy>=-2&yy<0)
B=Y./X+pi;
else
B=Y./X+3*pi/2;
end
Z=m.*atan(B);
figure(1);
meshc(x,y,Z);
比如上边程序,红色字应该怎么改呢,如果没法改应该怎么正确写呢,求大佬解答
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Language Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!