找回密码
 注册
Simdroid-非首页
查看: 121|回复: 8

用mesh画图时问题

[复制链接]
发表于 2012-2-5 07:07:43 | 显示全部楼层 |阅读模式 来自 陕西西安
悬赏30仿真币已解决
在MATLAB7.1中输入下列代码

s(1,i)是关于x,z的二元二次矩阵函数,

修改前错误:
x=0:0.1:1;z=0:1:75;
qq=s(1,1);
mesh(x,z,qq)
运行后没有出现图像只有一个坐标轴请高手解答下
??? Error using ==> set
View [azimuth elevation] must be a two element vector.
Error in ==> mesh at 128
      set(cax,'View',y);
Warning: Z must not be a scalar or vector, not rendering surface.
Warning: Z must not be a scalar or vector, not rendering surface.
Warning: Z must not be a scalar or vector, not rendering surface.
Warning: Z must not be a scalar or vector, not rendering surface.
Warning: Z must not be a scalar or vector, not rendering surface.

修改后错误:
X=0:0.1:1;Z=0:1:75;
[x,z]=meshgrid(X,Z);
mesh(x,z,s(1,1))
运行后没有出现图像只有一个坐标轴请高手解答下
出现这错误提示:
??? Error using ==> graph3d.surfaceplot.surfaceplot>localConstructor
Invalid input arguments
Error in ==> mesh at 135
           hh = graph3d.surfaceplot(x,y,z,'FaceColor',fc,'EdgeColor','flat', ...
想得到一个关于x,z,s(1,1)的三维曲线图。
发表于 2012-2-5 07:07:44 | 显示全部楼层 来自 山东青岛
Simdroid开发平台
本帖最后由 liuyalong008 于 2012-2-5 15:42 编辑
  1. X=0:0.1:1;Z=0:1:75;
  2. [x,z]=meshgrid(X,Z);
  3. s=x.^2+z.^2;
  4. mesh(x,z,s)
  5. hold on
  6. plot3(x(1,1),z(1,1),s(1,1),'o','markersize',8)
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×

评分

1

查看全部评分

回复

使用道具 举报

 楼主| 发表于 2012-2-7 16:44:01 | 显示全部楼层 来自 陕西西安
我刚才试了一下,用你的代码确实可以,不过把s函数换成我的就不行了:s(1,i)=
297/10*(2829640491/4+522185200*x)/(79905/2+31000*x)+297/10*(z-((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x))/(-9436142375/2-62/3*(90+500*x)^3+69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*(348100-(90+500*x)^2)-69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*(500-500*x)+131*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*((90+500*x)^2-8100)-65500*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*x+1398375/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)-10905/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2)*((69*(2829640491/4+522185200*x)/(79905/2+31000*x)-6229251/5)*(500-500*x)*(250*x+505)+500*(131*(2829640491/4+522185200*x)/(79905/2+31000*x)-11451103/5)*x*(165+250*x)+1398375/4*(2829640491/4+522185200*x)/(79905/2+31000*x)-2907890731971300489975/549755813888)-684381625628649003/1374389534720
你在看看:)
回复

使用道具 举报

发表于 2012-2-8 18:15:29 | 显示全部楼层 来自 山东青岛
银杏树之舞 发表于 2012-2-7 16:44
我刚才试了一下,用你的代码确实可以,不过把s函数换成我的就不行了:s(1,i)=
297/10*(2829640491/4+522185 ...

请写清楚s 的具体表达式   维数!!!
回复

使用道具 举报

发表于 2012-2-9 23:47:40 | 显示全部楼层 来自 陕西西安
这是计算s(1,i)的表达式
syms x z;
for i=1:1:4
EM=(z-zb)/p;
s(1,i)=E(1,i)*(ET+EM-a(1,i)*T);
disp('s(1,i)=');
disp(s(1,i));
end
这是运算结果:
s(1,i)=
297/10*(2829640491/4+522185200*x)/(79905/2+31000*x)+297/10*(z-((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x))/(-9436142375/2-62/3*(90+500*x)^3+69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*(348100-(90+500*x)^2)-69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*(500-500*x)+131*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*((90+500*x)^2-8100)-65500*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*x+1398375/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)-10905/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2)*((69*(2829640491/4+522185200*x)/(79905/2+31000*x)-6229251/5)*(500-500*x)*(250*x+505)+500*(131*(2829640491/4+522185200*x)/(79905/2+31000*x)-11451103/5)*x*(165+250*x)+1398375/4*(2829640491/4+522185200*x)/(79905/2+31000*x)-2907890731971300489975/549755813888)-684381625628649003/1374389534720

s(1,i)=
215*(2829640491/4+522185200*x)/(79905/2+31000*x)+215*(z-((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x))/(-9436142375/2-62/3*(90+500*x)^3+69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*(348100-(90+500*x)^2)-69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*(500-500*x)+131*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*((90+500*x)^2-8100)-65500*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*x+1398375/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)-10905/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2)*((69*(2829640491/4+522185200*x)/(79905/2+31000*x)-6229251/5)*(500-500*x)*(250*x+505)+500*(131*(2829640491/4+522185200*x)/(79905/2+31000*x)-11451103/5)*x*(165+250*x)+1398375/4*(2829640491/4+522185200*x)/(79905/2+31000*x)-2907890731971300489975/549755813888)-3142569

s(1,i)=
131*(2829640491/4+522185200*x)/(79905/2+31000*x)+131*(z-((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x))/(-9436142375/2-62/3*(90+500*x)^3+69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*(348100-(90+500*x)^2)-69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*(500-500*x)+131*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*((90+500*x)^2-8100)-65500*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*x+1398375/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)-10905/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2)*((69*(2829640491/4+522185200*x)/(79905/2+31000*x)-6229251/5)*(500-500*x)*(250*x+505)+500*(131*(2829640491/4+522185200*x)/(79905/2+31000*x)-11451103/5)*x*(165+250*x)+1398375/4*(2829640491/4+522185200*x)/(79905/2+31000*x)-2907890731971300489975/549755813888)-11451103/5

s(1,i)=
69*(2829640491/4+522185200*x)/(79905/2+31000*x)+69*(z-((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x))/(-9436142375/2-62/3*(90+500*x)^3+69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*(348100-(90+500*x)^2)-69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*(500-500*x)+131*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*((90+500*x)^2-8100)-65500*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*x+1398375/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)-10905/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2)*((69*(2829640491/4+522185200*x)/(79905/2+31000*x)-6229251/5)*(500-500*x)*(250*x+505)+500*(131*(2829640491/4+522185200*x)/(79905/2+31000*x)-11451103/5)*x*(165+250*x)+1398375/4*(2829640491/4+522185200*x)/(79905/2+31000*x)-2907890731971300489975/549755813888)-6229251/5

回复

使用道具 举报

发表于 2012-2-9 23:49:33 | 显示全部楼层 来自 陕西西安
这是s(1,i)的计算表达式
syms x z;
for i=1:1:4
EM=(z-zb)/p;
s(1,i)=E(1,i)*(ET+EM-a(1,i)*T);
disp('s(1,i)=');
disp(s(1,i));
end
这是运算结果:
s(1,i)=
297/10*(2829640491/4+522185200*x)/(79905/2+31000*x)+297/10*(z-((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x))/(-9436142375/2-62/3*(90+500*x)^3+69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*(348100-(90+500*x)^2)-69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*(500-500*x)+131*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*((90+500*x)^2-8100)-65500*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*x+1398375/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)-10905/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2)*((69*(2829640491/4+522185200*x)/(79905/2+31000*x)-6229251/5)*(500-500*x)*(250*x+505)+500*(131*(2829640491/4+522185200*x)/(79905/2+31000*x)-11451103/5)*x*(165+250*x)+1398375/4*(2829640491/4+522185200*x)/(79905/2+31000*x)-2907890731971300489975/549755813888)-684381625628649003/1374389534720

s(1,i)=
215*(2829640491/4+522185200*x)/(79905/2+31000*x)+215*(z-((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x))/(-9436142375/2-62/3*(90+500*x)^3+69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*(348100-(90+500*x)^2)-69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*(500-500*x)+131*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*((90+500*x)^2-8100)-65500*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*x+1398375/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)-10905/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2)*((69*(2829640491/4+522185200*x)/(79905/2+31000*x)-6229251/5)*(500-500*x)*(250*x+505)+500*(131*(2829640491/4+522185200*x)/(79905/2+31000*x)-11451103/5)*x*(165+250*x)+1398375/4*(2829640491/4+522185200*x)/(79905/2+31000*x)-2907890731971300489975/549755813888)-3142569

s(1,i)=
131*(2829640491/4+522185200*x)/(79905/2+31000*x)+131*(z-((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x))/(-9436142375/2-62/3*(90+500*x)^3+69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*(348100-(90+500*x)^2)-69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*(500-500*x)+131*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*((90+500*x)^2-8100)-65500*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*x+1398375/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)-10905/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2)*((69*(2829640491/4+522185200*x)/(79905/2+31000*x)-6229251/5)*(500-500*x)*(250*x+505)+500*(131*(2829640491/4+522185200*x)/(79905/2+31000*x)-11451103/5)*x*(165+250*x)+1398375/4*(2829640491/4+522185200*x)/(79905/2+31000*x)-2907890731971300489975/549755813888)-11451103/5

s(1,i)=
69*(2829640491/4+522185200*x)/(79905/2+31000*x)+69*(z-((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x))/(-9436142375/2-62/3*(90+500*x)^3+69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*(348100-(90+500*x)^2)-69*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*(500-500*x)+131*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)*((90+500*x)^2-8100)-65500*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2*x+1398375/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)/(79905/2+31000*x)-10905/2*((139035-69000*x)*(500-500*x)+500*(196500*x+1965)*x+527625/2)^2/(79905/2+31000*x)^2)*((69*(2829640491/4+522185200*x)/(79905/2+31000*x)-6229251/5)*(500-500*x)*(250*x+505)+500*(131*(2829640491/4+522185200*x)/(79905/2+31000*x)-11451103/5)*x*(165+250*x)+1398375/4*(2829640491/4+522185200*x)/(79905/2+31000*x)-2907890731971300489975/549755813888)-6229251/5
回复

使用道具 举报

发表于 2012-2-9 23:52:08 | 显示全部楼层 来自 陕西西安
本来想直接用for循环mesh出四幅曲线图,可是总出错,就想分开算,可是mesh还是有问题
回复

使用道具 举报

 楼主| 发表于 2012-2-12 12:23:27 | 显示全部楼层 来自 陕西西安
谢谢liuyalong008 ,用你的程序,一开始总出错,后来知道矩阵得用.*和./,修改后就出来了:victory:
回复

使用道具 举报

发表于 2012-2-14 20:23:02 | 显示全部楼层 来自 湖北武汉
学习了,哈哈
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-4-27 20:31 , Processed in 0.042391 second(s), 15 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表