the question about solving nonlinear equations
1 view (last 30 days)
Show older comments
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 Comments
Answers (2)
Silibelo Kamwi
on 7 May 2012
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 Comments
Sargondjani
on 8 May 2012
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 Comments
See Also
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!