Error using ==> fcnchk
If FUN is a MATLAB object, it must have an feval method.
Error in ==> C:\MATLAB6p5\toolbox\matlab\funfun\fminsearch.m
On line 110 ==> funfcn = fcnchk(funfcn,length(varargin));
头痛中。。。程序附上
clear
syms A B C D K a b E v w u h Q0 f;
D=E*h^3/(12*(1-v^2))
A=-Q0*b^3*(3+v+2*(1+v)*log(b/a)+a^2*(1-v)/b^2)/(8*D*(b^2+a^2+(b^2-a^2)*v))
B=Q0*b/(4*D)
C=-(2*A+B)*a^2
K=-A*a^2
/*以上为参数
/*下面是函数
w=A*b^2+B*b^2*log(b/a)+C*log(b/a)+K
u=(b^3+a^2*b)/(2*E*a*(a^2+b^2))
f=w/u
/*求极小值
a0=[0,100]
a=fminsearch(f,a0)
Error using ==> fcnchk
If FUN is a MATLAB object, it must have an feval method.
...
建议多看matlab帮助:
Example 1. A classic test example for multidimensional minimization is the Rosenbrock banana function
The minimum is at (1,1) and has the value 0. The traditional starting point is (-1.2,1). The anonymous function shown here defines the function and returns a function handle called banana:
banana = @(x)100*(x(2)-x(1)^2)^2+(1-x(1))^2;
Pass the function handle to fminsearch:
[x,fval] = fminsearch(banana,[-1.2, 1])
This produces
x =
1.0000 1.0000
fval =
8.1777e-010