求助,这程序哪出问题了?
>> x=y=[-71.525 8.1722e+005 1.2109e+006 1.6137e+006 1.9864e+006 2.3373e+006 2.9319e+006 3.8018e+006 4.3019e+006 4.7963e+006 5.3595e+006 5.7329e+006 6.0958e+006 6.2835e+006 6.3516e+006 6.2852e+006 6.3562e+006 6.4678e+006 6.6246e+006]
fun=inline('(x^2*0.0751+0.6192*x*(1-x)*(1-K(2))+(1-x)^2*0.5442)+(x^2*27.5511+2*x*(1-x)*(2.3716e+004)^0.5*(1-K(1))+(1-x)^2*860.8071)*(x^2*0.0751+2*x*(1-x)*(0.3096*(1-K(2)))+(1-x)^2*0.5442)/((2^0.5)*R*T)','K','x')
K0=;
K=lsqcurvefit(fun,K0,x,y)
x =
Columns 1 through 8
0 0.0393 0.0620 0.0802 0.0971 0.1186 0.1388 0.1660
Columns 9 through 16
0.2176 0.2689 0.3228 0.3977 0.4611 0.5446 0.6236 0.7379
Columns 17 through 19
0.8406 0.8658 0.8743
y =
1.0e+006 *
Columns 1 through 8
-0.0001 0.8172 1.2109 1.6137 1.9864 2.3373 2.9319 3.8018
Columns 9 through 16
4.3019 4.7963 5.3595 5.7329 6.0958 6.2835 6.3516 6.2852
Columns 17 through 19
6.3562 6.4678 6.6246
fun =
Inline function:
fun(K,x) = (x^2*0.0751+0.6192*x*(1-x)*(1-K(2))+(1-x)^2*0.5442)+(x^2*27.5511+2*x*(1-x)*(2.3716e+004)^0.5*(1-K(1))+(1-x)^2*860.8071)*(x^2*0.0751+2*x*(1-x)*(0.3096*(1-K(2)))+(1-x)^2*0.5442)/((2^0.5)*R*T)
??? Error using ==> optim\private\lsqncommon
User supplied expression or inline function ==> (x^2*0.0751+0.6192*x*(1-x)*(1-K(2))+(1-x)^2*0.5442)+(x^2*27.5511+2*x*(1-x)*(2.3716e+004)^0.5*(1-K(1))+(1-x)^2*860.8071)*(x^2*0.0751+2*x*(1-x)*(0.3096*(1-K(2)))+(1-x)^2*0.5442)/((2^0.5)*R*T)
failed with the following error:
Error using ==> inlineeval
Error in inline expression ==> (x^2*0.0751+0.6192*x*(1-x)*(1-K(2))+(1-x)^2*0.5442)+(x^2*27.5511+2*x*(1-x)*(2.3716e+004)^0.5*(1-K(1))+(1-x)^2*860.8071)*(x^2*0.0751+2*x*(1-x)*(0.3096*(1-K(2)))+(1-x)^2*0.5442)/((2^0.5)*R*T)
??? Error using ==> mpower
Matrix must be square.
Error in ==> lsqcurvefit at 149
= ... 原帖由 hongyie 于10:33 AM 发表
>> x=
y=
fun=inline('(x^2*0.0751+0.6192*x*(1-x)*(1-K(2))+(1-x)^2*0.5442)+(x^2*27.5511+2*x*(1-x)*(2.3716e+004)^0.5*(1-K(1))+(1-x)^2*860.8071)*(x^2*0.0751+2*x*(1-x)*(0.3096*(1-K(2)))+(1-x)^2* ...
请看matlab基础书关于“点乘和乘的区别” 已解决
非常感谢2楼!!!
页:
[1]