MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 下面的代码哪里错误 (https://www.labfans.com/bbs/showthread.php?t=8258)

laurence06 2009-05-11 19:04

下面的代码哪里错误
 
a=100;
b=0:0.01:0.55;
theta=2.5;
c=1;
h=0.25;
w=2.5;
space=((a*b) ./(h*theta))^(1 ./(1-b))*((theta-1) ./(theta*w))^((theta-1) ./(1-b));
plot(space,b,'mh');
grid on
[COLOR="Red"]??? Error using ==> mpower
At least one operand must be scalar.[/COLOR]

zougaoming 2009-05-11 19:14

回复: 下面的代码哪里错误
 
你要知道“/”和“./”,以及“*”和“.*”的区别

laurence06 2009-05-11 19:17

回复: 下面的代码哪里错误
 
[QUOTE=zougaoming;27652]你要知道“/”和“./”,以及“*”和“.*”的区别[/QUOTE]

请详细说下吧:此处是除法,我是按书用的是./ 如果用/,则会出现

[COLOR="Red"]??? Error using ==> mrdivide
Matrix dimensions must agree[/COLOR]. 的错误

yhcode 2009-05-11 21:05

回复: 下面的代码哪里错误
 
./是两个等维矩阵对应点相除, /是矩阵除以一个常数,不能完成矩阵除法(好像是,一时给忘了,呵呵)


所有时间均为北京时间。现在的时间是 04:54

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.