I want to know why MATLAB says "Equation solved at initial point"

2 visualizaciones (últimos 30 días)
Hi everybody,
I have a code that gives the following answer from MATLAB:
"Equation solved at initial point.
fsolve completed because the vector of function values at the initial
point is near zero as measured by the selected value of the function tolerance,
and the problem appears regular as measured by the gradient. "
What is wrong ?
Thanks a lot to everybody!!
Here the code:
function main
x0 = rand(5,1);
options = optimoptions(@fsolve, 'Algorithm', 'levenberg-marquardt', 'MaxFunctionEvaluations', 1000000, 'MaxIterations', 1000000,'OptimalityTolerance', 1e-10, 'FunctionTolerance', 1e-08);
x = fsolve(@fun,x0,options)
res = fun(x)
k1 = x(1)^2;
k2 = x(2)^2;
k3 = x(3)^2;
k4 = x(4)^2;
k7 = x(5)^2;
%K1 = k3/(k4+k7)
end
function res = fun(x)
k1 = x(1)^2; %because I need positive k's
k2 = x(2)^2;
k3 = x(3)^2;
k4 = x(4)^2;
k7 = x(5)^2;
ET=0.5
i1=0.009621821;
i2=0.030538822;
i3=0.054802544;
i4=0.068189424;
i5=0.084504685;
i6=0.091198126;
i7=0.094544846;
i8=0.110441767;
i9=0.112951807;
i10=0.125502008;
x1=0;
x2=30;
x3=50;
x4=75;
x5=100;
x6=130;
x7=160;
x8=200;
x9=280;
x10=380;
%h correspond à E au niveau de la branche "Dimerization" (eq. 82)
h1 = (-(k2+k1*x1-k7*k3/(k4+k7)*ET)+sqrt((k2+k1*x1-k7*k3/(k4+k7)*ET)^2+4*k2*ET*(2*k1*k3/(k4+k7)*x1+k7*k3/(k4+k7))))/(2*k3/(k4+k7)*(k7+2*k1*x1));
h2 = (-(k2+k1*x2-k7*k3/(k4+k7)*ET)+sqrt((k2+k1*x2-k7*k3/(k4+k7)*ET)^2+4*k2*ET*(2*k1*k3/(k4+k7)*x2+k7*k3/(k4+k7))))/(2*k3/(k4+k7)*(k7+2*k1*x2));
h3 = (-(k2+k1*x3-k7*k3/(k4+k7)*ET)+sqrt((k2+k1*x3-k7*k3/(k4+k7)*ET)^2+4*k2*ET*(2*k1*k3/(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ET-h10)/(1+2*k3/(k4+k7)*h10);
end

Respuestas (0)

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by