How to fix Error using trustnleqn (line 28) Objective function is returning undefined values at initial point. FSOLVE cannot continue.
Afficher commentaires plus anciens
Hi, could anyone help me? I am having this error.
Error using trustnleqn (line 28) Objective function is returning undefined values at initial point. FSOLVE cannot continue.
Error in fsolve (line 388) trustnleqn(funfcn,x,verbosity,gradflag,options,defaultopt,f,JAC,...
global W_RMPL lambda0_RMPL n m1_RMPL
n = 5;
lambda0_RMPL = -3.9465;
W_RMPL = [-0.806323524683253,-1.40611713252880,-0.867814301186637,1.91256242324179,0.0628391323302569];
m1_RMPL = sum(W_RMPL)/n;;
fun_RMPL = @root2d_RMPL;
x0_RMPL = [-0.6140,0.2490];
options = optimset('Display','off');
S_RMPL = fsolve(fun_RMPL ,x0_RMPL ,options)
%function
function E = root2d_RMPL(x)
global W_RMPL n m1_RMPL lambda0_RMPL
E(1) = ((m1_RMPL - x(1))./x(2)) - (lambda0_RMPL./n).*sum(normpdf((lambda0_RMPL.*(W_RMPL -x(1))./x(2)))./normcdf((lambda0_RMPL.*(W_RMPL -x(1))./x(2))));
E(2) = (-1) + (1/n).*sum(((W_RMPL -x(1)).^2)/(x(2).^2)) - (lambda0_RMPL./(n)).*sum(((W_RMPL -x(1))./x(2)).*normpdf((lambda0_RMPL.*(W_RMPL -x(1))./x(2)))./normcdf((lambda0_RMPL.*(W_RMPL -x(1))./x(2))));
Thank you.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!