声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 851|回复: 5

[编程技巧] Matrix dimensions must agree 出错求助

 关闭 [复制链接]
发表于 2008-4-23 13:52 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
用下面语句执行

x=0.1:0.1:10;
y=x;
[x,y]=meshgrid(x,y);
mesh(x,y,150/sqrt((x*0.85*0.85+y*0.9*0.9)/(x+y)))

结果为

Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 2.288462e-022.
(Type "warning off MATLAB:nearlySingularMatrix" to suppress this warning.)
??? Error using ==> /
Matrix dimensions must agree.


这该怎么处理一哈??

[ 本帖最后由 eight 于 2008-4-23 15:16 编辑 ]
回复
分享到:

使用道具 举报

发表于 2008-4-23 14:03 | 显示全部楼层
没有猜错的话,你想使用的./而不是/
 楼主| 发表于 2008-4-23 14:10 | 显示全部楼层

x=0.1:0.1:10;
y=x;
[x,y]=meshgrid(x,y);
mesh(x,y,150/sqrt((x*0.85*0.85+y*0.9*0.9)./(x+y)))

出来


??? Error using ==> /
Matrix dimensions must agree.
发表于 2008-4-23 14:23 | 显示全部楼层
原帖由 yelv123 于 2008-4-23 14:10 发表

x=0.1:0.1:10;
y=x;
[x,y]=meshgrid(x,y);
mesh(x,y,150/sqrt((x*0.85*0.85+y*0.9*0.9)./(x+y)))

出来


??? Error using ==> /
Matrix dimensions must agree.


试试这个:
mesh(x,y,150./sqrt((x*0.85*0.85+y*0.9*0.9)./(x+y)))
发表于 2008-4-23 14:23 | 显示全部楼层

回复 3楼 的帖子

x=0.1:0.1:10;
y=x;
[x,y]=meshgrid(x,y);
mesh(x,y,150./sqrt((x*0.85*0.85+y*0.9*0.9)./(x+y)));
发表于 2008-4-23 15:17 | 显示全部楼层
老掉牙的问题了,自己好好看书,或者看置顶区 for 新手系列 的帖子,此帖关闭处理
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-23 11:28 , Processed in 0.058654 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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