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!