matlab运行后出现:Error:Unbalanced or unexpected parenthesis or bracket.怎么修改syms z;r=250;l=500;for N=1:30c=N/pi/r^2;b=acos((l-z)./sqrt(l^2+r^2-2*l.*z));a=r^2.*(acos(z/r)-z.*sqrt(r^2-z.^2)/r)+(l^2+r^2-2*l*z).*(b-sqrt((r^2-z.^2)./(l^2+r^2-2

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/18 05:36:44
matlab运行后出现:Error:Unbalanced or unexpected parenthesis or bracket.怎么修改syms z;r=250;l=500;for N=1:30c=N/pi/r^2;b=acos((l-z)./sqrt(l^2+r^2-2*l.*z));a=r^2.*(acos(z/r)-z.*sqrt(r^2-z.^2)/r)+(l^2+r^2-2*l*z).*(b-sqrt((r^2-z.^2)./(l^2+r^2-2
xMkAǿJ@hf54'=ͪ! %F,XJ"hD0i-0[N~'-(b= f Nqz&DI7 p0 %mc!hBK7jg,c {huwA f'A=rbMYUS[e>VY*SpUQu'J*YUiKPxS ǩP$"L:p8v$0L&J3QaŽS,` gHXz ^ ttut:4)(׉ܽTPN[] P9 VǴ=PeX%:|ẅ́㍭)K {[˷o.߈vQ"SHSd l* ~jP)i1iZS (<| ۨepM]"l[HEz = _ :bO6

matlab运行后出现:Error:Unbalanced or unexpected parenthesis or bracket.怎么修改syms z;r=250;l=500;for N=1:30c=N/pi/r^2;b=acos((l-z)./sqrt(l^2+r^2-2*l.*z));a=r^2.*(acos(z/r)-z.*sqrt(r^2-z.^2)/r)+(l^2+r^2-2*l*z).*(b-sqrt((r^2-z.^2)./(l^2+r^2-2
matlab运行后出现:Error:Unbalanced or unexpected parenthesis or bracket.怎么修改
syms z;
r=250;
l=500;
for N=1:30
c=N/pi/r^2;
b=acos((l-z)./sqrt(l^2+r^2-2*l.*z));
a=r^2.*(acos(z/r)-z.*sqrt(r^2-z.^2)/r)+(l^2+r^2-2*l*z).*(b-sqrt((r^2-z.^2)./(l^2+r^2-2*l.*z)));
F=(2.*z.*l*c*b*exp(-c*a));
F=eval(['@z',vectorize(F)]);
E(N)=quadgk(F,0,r);
end
plot(E,'-ok')
请问问题出在哪里?

matlab运行后出现:Error:Unbalanced or unexpected parenthesis or bracket.怎么修改syms z;r=250;l=500;for N=1:30c=N/pi/r^2;b=acos((l-z)./sqrt(l^2+r^2-2*l.*z));a=r^2.*(acos(z/r)-z.*sqrt(r^2-z.^2)/r)+(l^2+r^2-2*l*z).*(b-sqrt((r^2-z.^2)./(l^2+r^2-2

你的MATLAB是什么版本?

我在2007b、2008b上都没见到你说的问题.

 

代码中有一点小问题:应该把

    F=eval(['@z',vectorize(F)]);
改成

    F=eval(['@(z)',vectorize(F)]);