MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]新手问题 (https://www.labfans.com/bbs/showthread.php?t=5660)

simonspringzz 2008-12-06 10:14

[求助]新手问题
 
计算f(x)=sinx+3的最小值
编写程序
function f=myfun(x);
syms x;
f=sin(x)+3;

之后运行
x0=2; %以x0为初始点
[x,fval]=fminsearch(@myfun,x0)


运行却提示出错:
[COLOR="Red"]??? Conversion to double from sym is not possible.

Error in ==> D:\MATLAB6p5\toolbox\matlab\funfun\fminsearch.m
On line 125 ==> fv(:,1) = feval(funfcn,x,varargin{:}); [/COLOR]

刚学matlab,还很不熟悉,望高手指教!


所有时间均为北京时间。现在的时间是 13:01

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