本文共 1195 字,大约阅读时间需要 3 分钟。
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
这是一个求极小值的问题
fun.m文件程序如下
function f=fun(x)
P1=102.6402;
t1=3.6;
c1=0.0352866;c2=0.377616;c3=-0.008852;c4=82.768353;c5=-3.594521;
c6=0.0392739;c7=1;c8=1;
f=-(-844/2*log(2*Pi)-1/2*c7-1/2*c8-(844/2)*log(x(1)^2)-1/2*(x(1)^(-2))*(c1+(c2)*...
x(2)*x(3)+(c3)*x(2)+c4*x(2)^2*x(3)^2+(c5)*x(2)^2*x(3)+c6*x(2)^2)-M/2*log(2*Pi)-M/2*log(x(4)^2)...
-1/2*(x(4)^(-2))*((logP1-log(2*((x(2)+x(5))^2+2*x(1)^2)^(1/2)*exp((x(2)+x(5)+((x(2)+x(5))^2+...
2*x(1)^2)^(1/2))*t1/2)/((x(2)+x(5)+((x(2)+x(5))^2+2*x(1)^2)^(1/2))*(exp(((x(2)+x(5))^2+2*x(1)^2)^(1/2)*t1)-1)...
+2*((x(2)+x(5))^2+2*x(1)^2)^(1/2)))*2*x(2)*x(3)/(x(1)^2)-2*(exp(((x(2)+x(5))^2+2*x(1)^2)^(1/2)*t1)-1)/...
((x(2)+x(5)+((x(2)+x(5))^2+2*x(1)^2)^(1/2))*(exp(((x(2)+x(5))^2+2*x(1)^2)^(1/2)*t1)-1)+2*((x(2)+x(5))^2+2*x(1)^2)...
^(1/2))*t1)^2));
>> x=[1,1,1,1,1];
>> x=fminsearch('fun',x)
??? Capitalized internal function Pi; Caps Lock may be on.
Error in ==> E:\Program Files\Matlab\work\fun.m
On line 14 ==> f=-(-844/2*log(2*Pi)-1/2*c7-1/2*c8-(844/2)*log(x(1)^2)-1/2*(x(1)^(-2))*(c1+(c2)*...
Error in ==> E:\Program Files\Matlab\toolbox\matlab\funfun\fminsearch.m
On line 125 ==> fv(:,1) = feval(funfcn,x,varargin{:});
错在哪里哪位高手帮忙改一下
转载地址:http://vjyzo.baihongyu.com/