Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead.
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kimiya Oshikoji
el 17 de Jul. de 2015
I am trying to obtain a numerical answer for a non linear system with 3 equations and 3 unknowns. When running the code, I receive:
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm
instead.
> In fsolve (line 287)
In RegimeTwo (line 60)
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the selected value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>
Equation solved. The sum of squared function values, r = 1.832713e-25, is less
than sqrt(options.TolFun) = 1.000000e-03. The relative norm of the gradient of
r, 3.027138e-14, is less than 1e-4*options.TolFun = 1.000000e-10.
Optimization Metric Options
relative norm(grad r) = 3.03e-14 1e-4*TolFun = 1e-10 (selected)
r = 1.83e-25 sqrt(TolFun) = 1.0e-03 (selected)
My code:
opts = optimset('fsolve');
opts = optimset(opts,'Maxiter',700,'Tolx',1e-6,'tolfun',1e-6);
xx = [0 0 0];
nle = fsolve(Switch,xx,opts, lambda,row, mu, mu_one, a, b, c, r, gamma, A, sigma_one, beta1,delta1);
OP = nle(1,1);
EC = nle(1,2);
OC = nle(1,3);
My function:
function [m, VM, SP] = Switch(h,lambda,row, mu, mu_one, a, b, c, r, gamma, A, sigma_one, beta1,delta1)
OP = h(1);
EC = h(2);
OC = h(3);
pi = (lambda+row-mu)/((row+lambda-mu_one)*(row-mu));
m = -OC+((1/(r*b*gamma))*(pi*row*OP-c-r*a))^(1/(gamma-1)) ;
A_hat= (-lambda*A)/ (((sigma_one^2)/2)*beta1*(beta1-1)+(mu_one*beta1)-(row+lambda)) ;
VM = A_hat*(OP^beta1) + EC*(OP^delta1)- (pi*OC*OP)+((c*OC+r*(a*OC+b*(OC^gamma)))/row);
SP = beta1*A_hat*(OP^(beta1-1)) + delta1*EC*(OP^(delta1-1))- (pi*OC);
Any ideas where I am going wrong?
0 comentarios
Respuesta aceptada
Torsten
el 17 de Jul. de 2015
function res = Switch(h,lambda,row, mu, mu_one, a, b, c, r, gamma, A, sigma_one, beta1,delta1)
OP = h(1); EC = h(2); OC = h(3);
pi = (lambda+row-mu)/((row+lambda-mu_one)*(row-mu));
m = -OC+((1/(r*b*gamma))*(pi*row*OP-c-r*a))^(1/(gamma-1)) ;
A_hat= (-lambda*A)/ (((sigma_one^2)/2)*beta1*(beta1-1)+(mu_one*beta1)-(row+lambda)) ;
VM = A_hat*(OP^beta1) + EC*(OP^delta1)- (pi*OC*OP)+((c*OC+r*(a*OC+b*(OC^gamma)))/row);
SP = beta1*A_hat*(OP^(beta1-1)) + delta1*EC*(OP^(delta1-1))- (pi*OC);
res(1,1) = m;
res(2,1) = VM;
res(3,1) = SP;
Best wishes
Torsten.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Gamma Functions 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!