第一步,myfun.m如下:
function F = myfun(x)
F=9.1-(6.02)*(1+x(2)*exp(4*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(4*x(3)));
14.2-(16.82)*(1+x(2)*exp(14*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(14*x(3)));
8.4-(44.02)*(1+x(2)*exp(22*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(22*x(3)));
10.4-(127.39)*(1+x(2)*exp(32*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(32*x(3)));
第二步:
x0 = [1;1;0.01;1];
options=optimset('Display','iter');
[x,fval] = fsolve(@myf,x0,options) % Call solver
结果为:
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt
algorithm instead.
> In fsolve at 314
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.
F should be a vector function....
function F = myfun(x)
F=[ 9.1-(6.02)*(1+x(2)*exp(4*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(4*x(3))); ...
14.2-(16.82)*(1+x(2)*exp(14*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(14*x(3))); ...
8.4-(44.02)*(1+x(2)*exp(22*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(22*x(3))); ...
10.4-(127.39)*(1+x(2)*exp(32*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(32*x(3))) ];