function f =zhfun(a)
f1 = int(x*exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3)/m(1)*int(exp(a(1)*x+a(2)*x^2 +a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3);
f2 =int(x^2*exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3)/m(2)*int(exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3);
f3 =int(x^3*exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3)/m(3)*int(exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3);
f4 = int(x^4*exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3)/m(4)*int(exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3);
f5 =int(x^5*exp(a(1)*x+a(2)*x^2 +a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3)/m(5)*int(exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3);
f =f1.^2+f2.^2+f3.^2+f4.^2+f5.^2
%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> m =[-0.0395,0.8244,-0.0655,1.61858,-0.1283];
>> a0 =[-1,0,0,0,0];
>> a=lsqnonlin(zhfun,a0)
??? Input argument "x" is undefined.
Error in ==> zhfun at 2
f1 = int(x*exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3)/m(1)*int(exp(a(1)*x+a(2)*x^2 +a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3);
>> a =lsqnonlin(zhfun,a0)
??? Undefined function or variable 'x'.
Error in ==> zhfun at 2
f1 = int(x*exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3)/m(1)*int(exp(a(1)*x+a(2)*x^2 +a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3);
>> syms x
>> a =lsqnonlin(zhfun,a0)
??? Undefined function or variable 'x'.
Error in ==> zhfun at 2
f1 = int(x*exp(a(1)*x+a(2)*x^2+a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3)/m(1)*int(exp(a(1)*x+a(2)*x^2 +a(3)*x^3+a(4)*x^4+a(5)*x^5),x,-3,3);
>> |