필터 지우기
필터 지우기

What does this fsolve error message mean: FSOLVE cannot handle non-square systems; switching to Gauss-Newton method?

조회 수: 8 (최근 30일)
Warning: Default trust-region dogleg method of FSOLVE cannot handle non-square systems; switching to Gauss-Newton method. > In fsolve at 232 In homework5 at 11 Conditioning of Gradient Poor - Switching To LM method Optimization terminated: directional derivative along search direction less than TolFun and infinity-norm of gradient less than 10*(TolFun+TolX).
Script:
clear all
close all
global beta delta alpha K1 KS
beta=0.98;
delta=0.1;
alpha=0.33;
K1=4;
KS=(1/(beta*alpha)-(1-delta))^(1/(alpha-1));
xstart=KS*ones(299,1);
x=fsolve(@fname,xstart)
K(1)=K1
for i=2:286
x(i)=K(i+1);
end
for i=287:300
x(i)=KS;
end
plot(K(1:40))
Function:
function F=fname(x)
global beta delta alpha K1 KS
F(1)=1/(K1^(alpha)-x(1)+(1-delta)*K1)-beta*(alpha*x(1)^(alpha-1)+(1-delta))/(x(1)^alpha-x(2)+(1-delta)*x(1));
for i=2:285
F(i)=1/(x(i-1)^alpha-x(i)+(1-delta)*x(i-1))-beta*(alpha*x(i)^(alpha-1)+(1-delta))/(x(i)^alpha-x(i+1)+(1-delta)*x(i));
end
F(286)=1/(x(285)^alpha-x(286)+(1-delta)*x(285))-beta*(alpha*x(286)^(alpha-1)+(1-delta))/(x(286)^alpha-KS+(1-delta)*x(286));
I copied this script and it ran perfectly at the university. What does this error message mean?

답변 (1개)

Zoltán Csáti
Zoltán Csáti 2014년 10월 25일
You set the vector of the initial solution to size 299 (so 299 number of unknowns are expected). However in the function definition fname you have only 286 entries meaning that the system is under-determined.

카테고리

Help CenterFile Exchange에서 Manual Performance Optimization에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by