wangdianqun 发表于 2008-5-5 16:41

Incomplete or misformed expression or statement 出错求助

麻烦楼主大哥帮帮我吧!fuctionF=mymfun(x)
f(1)=0.5*a.*exp(-0.25*pi*(x-b).^2);
f(2)=sqrt(1+(0.25*pi*a.*(x-b)).^2.*exp(-0.5*pi*(x-b).^2);
sym x
F(1)=quad(f(1),0,inf);
F(2)=quad(f(2),-inf,inf);
F=;
然后我在Command里引用
>> x0=[-1000000;1000000];
>> options=optimset('Display','iter');
>> =fsolve(@opt30_5o,x0,options)
??? Error: File: opt30_5o.m Line: 3 Column: 57
Incomplete or misformed expression or statement.

Error in ==> fsolve at 180
      fuser = feval(funfcn{3},x,varargin{:});
怎么老出错?这是怎么回事?

[ 本帖最后由 eight 于 2008-5-5 17:08 编辑 ]

eight 发表于 2008-5-5 17:09

??? Error: File: opt30_5o.m Line: 3 Column: 57
Incomplete or misformed expression or statement.根据出错提示自行查看、调试解决

sigma665 发表于 2008-5-5 18:33

回复 楼主 的帖子

f(2)=sqrt(1+(0.25*pi*a.*(x-b)).^2.*exp(-0.5*pi*(x-b).^2);

漏了一个括号

wangdianqun 发表于 2008-5-6 17:43

这位大哥,我改了,可还不行啊!还得求求你帮帮忙啊!

fuctionF=mymfun(x)
f(1)=0.5*x(1).*exp(-0.25*pi*(x-x(2)).^2);
f(2)=sqrt(1+(0.25*pi*x(1).*(x-x(2))).^2.*exp(-0.5*pi*(x-x(2)).^2));
sym x
F(1)=quad(f(1),0,inf);
F(2)=quad(f(2),-inf,inf);
F=;
然后我在Command里引用
>> x0=[-1000000;1000000];
>> options=optimset('Display','iter');
>> =fsolve(@opt30_5o,x0,options)
Warning: feval on script names will not work, or may work differently,
in a future version of MATLAB.To make your code insensitive to any change
and to suppress this warning message:
- Either change the script to a function.
- Or use eval instead of feval.
The script file in question is opt30_5o.
> In fsolve at 180
??? Attempt to execute SCRIPT opt30_5o as a function.

Error in ==> fsolve at 180
      fuser = feval(funfcn{3},x,varargin{:});
还是不行,这回我跟蒙了,我是个新手,不太会,谢谢了!

ch_j1985 发表于 2008-5-6 18:18

原帖由 wangdianqun 于 2008-5-6 17:43 发表 http://www.chinavib.com/forum/images/common/back.gif
fuctionF=mymfun(x)
f(1)=0.5*x(1).*exp(-0.25*pi*(x-x(2)).^2);
f(2)=sqrt(1+(0.25*pi*x(1).*(x-x(2))).^2.*exp(-0.5*pi*(x-x(2)).^2));
sym x
F(1)=quad(f(1),0,inf);
F(2)=quad(f(2),-inf,inf);
F=

可以参考这个帖子:
http://www.chinavib.com/forum/viewthread.php?tid=18886&extra=&page=1

wangdianqun 发表于 2008-5-11 18:25

谢谢!大哥

谢谢!真是太好了:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

superkaka123 发表于 2008-5-11 18:39

我要把权限弄到10啊!

[ 本帖最后由 eight 于 2008-5-12 18:27 编辑 ]

superkaka123 发表于 2008-5-11 18:39

:victory: 我是个新手,不太会,谢谢了!

eight 发表于 2008-5-12 18:28

原帖由 superkaka123 于 2008-5-11 18:39 发表 http://www.chinavib.com/forum/images/common/back.gif
:victory: 我是个新手,不太会,谢谢了! 大家上论坛要养成习惯:看置顶帖
页: [1]
查看完整版本: Incomplete or misformed expression or statement 出错求助