Matlab 单叶双曲线 总是画不出图!
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/07/01 14:11:56
Matlab 单叶双曲线 总是画不出图!
x1=-10:0.2:10;
y1=x1;
[x,y]=meshgrid(x1,y1);
a=1;b=1;c=1;
z1=sqrt(c.^2*(x.^2/(a.^2)+y.^2/(b.^2)-1));
z2=-sqrt(c.^2*(x.^2/(a.^2)+y.^2/(b.^2)-1));
mesh(x,y,z1)
hold on;
mesh(x,y,z2)
---------------------------------------------------
系统红字:
Error using ==> surface
X,Y,Z,and C cannot be complex.
Error in ==> C:\MATLAB6p5p1\toolbox\matlab\graph3d\mesh.m
On line 93 ==> hh = surface(x,y,z,'FaceColor',fc,'EdgeColor','flat','FaceLighting','none','EdgeLighting','flat');
怎么回事……疯了!
x1=-10:0.2:10;
y1=x1;
[x,y]=meshgrid(x1,y1);
a=1;b=1;c=1;
z1=sqrt(c.^2*(x.^2/(a.^2)+y.^2/(b.^2)-1));
z2=-sqrt(c.^2*(x.^2/(a.^2)+y.^2/(b.^2)-1));
mesh(x,y,z1)
hold on;
mesh(x,y,z2)
---------------------------------------------------
系统红字:
Error using ==> surface
X,Y,Z,and C cannot be complex.
Error in ==> C:\MATLAB6p5p1\toolbox\matlab\graph3d\mesh.m
On line 93 ==> hh = surface(x,y,z,'FaceColor',fc,'EdgeColor','flat','FaceLighting','none','EdgeLighting','flat');
怎么回事……疯了!
![Matlab 单叶双曲线 总是画不出图!](/uploads/image/z/15587783-71-3.jpg?t=Matlab+%E5%8D%95%E5%8F%B6%E5%8F%8C%E6%9B%B2%E7%BA%BF+%E6%80%BB%E6%98%AF%E7%94%BB%E4%B8%8D%E5%87%BA%E5%9B%BE%21)
没有问题,可以出图:
clear all;clc;
x1=-10:0.5:10;
y1=x1;
[x,y]=meshgrid(x1,y1);
a=1;b=1;c=1;
z1=sqrt(c^2*(x.^2/a^2+y.^2/b^2-1));
z2=-sqrt(c^2*(x.^2/a^2+y.^2/b^2-1));
surf(x,y,z1);hold on;
surf(x,y,z2);
![](http://img.wesiedu.com/upload/e/f4/ef4f261798994a04cf42d80463e46301.jpg)
clear all;clc;
x1=-10:0.5:10;
y1=x1;
[x,y]=meshgrid(x1,y1);
a=1;b=1;c=1;
z1=sqrt(c^2*(x.^2/a^2+y.^2/b^2-1));
z2=-sqrt(c^2*(x.^2/a^2+y.^2/b^2-1));
surf(x,y,z1);hold on;
surf(x,y,z2);
![](http://img.wesiedu.com/upload/e/f4/ef4f261798994a04cf42d80463e46301.jpg)