the question about solving nonlinear equations
1 次查看(过去 30 天)
显示 更早的评论
hello,
I am using matlab to solving a nonlinear equations.
here is my Function file as below:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Ve,x,r,t,sigmaE are parameters; X(1),X(2) are roots;
function F = YL_parameter(X,Ve,x,r,t,sigmaE)
Va= X(1);
sigmaA = X(2);
F(1) = Va*normcdf((log(Va/x)+(r+sigmaA^2/2)*t)/(sigmaA*sqrt(t))) - x*exp(-r*t)*normcdf((log(Va/x)+(r+sigmaA^2/2)*t)/(sigmaA*sqrt(t)) - sigmaA*sqrt(t)) - Ve;
F(2) = (Va/Ve)*sigmaA*normcdf((log(Va/x)+(r+sigmaA^2/2)*t)/(sigmaA*sqrt(t))) - sigmaE;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
however, the matlab cannot solve the roots with exception as follows:
y= [1,1]
y =
1 1
>> [X,fval,exitflag]=fsolve(@(X)YL_parameter(X,Ve(1),x(1),r(1),t(1),sigmaE(1)),y)
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
default value of the function tolerance.
<stopping criteria details>
X =
1 1
fval =
1.0e+010 *
-1.578202295500000 -0.000000000033697
exitflag =
-2
I don't know why? (is the problem initial value of the roots?)
0 个评论
回答(2 个)
Silibelo Kamwi
2012-5-7
Check in the optimization toolbox how fminunc or unconstrained optimization works.it might be able to help with nonlinear equations, but you need to get the derivative of the your system of equations.
hope this helps, IK
0 个评论
Sargondjani
2012-5-8
hmmm. strange. only thing i can think of is that the gradient is extremely large (infinity?) at this particular point...
did you try (many) different starting values??
it would also help if you supply the parameters values, so we can check everything ourselves
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!