필터 지우기
필터 지우기

fsolve and "Equation solved, fsolve stalled"

조회 수: 17 (최근 30일)
Federico MegaMan
Federico MegaMan 2019년 11월 20일
편집: Matt J 2019년 11월 21일
Hello,
when I run my fsolve it works, but appears this message:
"Equation solved, fsolve stalled.
fsolve stopped because the relative size of the current step is less than the
default value of the step size tolerance and the vector of function values
is near zero as measured by the default value of the function tolerance.
<stopping criteria details>".
What does it mean precisely?
clear all
clc
close all
kT21=0;
kT22=pi/2;%87°
kr23=3.1623;
kT23=4.391248;%248.5°
kT31=0;%0.226;%13°
kr32=3.1623;
kT32=1.8919369;%106°
kT33=1.5*pi;
kT11=1.106538;%62
kT12=0;
kT13=0;%01.5*pi+1.517
kT14=0;%0.226;
kT15=5.176646;%316°
%x0=[kT11,kT12,kT13,kT14,kT15,kT22,kT23,kr23,kT31,kT32,kT33,kr32,jT21];
j=0;
xsol=zeros(13,51);
T21=zeros(1,51);
for t=0:0.1:5
j=j+1;
T11(j)=0.073*cos(t)+1.08;
end
for k=1:numel(T11)
xsol(:,k)=fsolve(@(x) funz2(x), [T11(k),kT12,kT13,kT14,kT15,kT22,kT23,kr23,kT31,kT32,kT33,kr32,kT21]);
kxsol=xsol(:,k);
kT13=kxsol(3);
kT21=kxsol(13);
kT12=kxsol(2);
kT14=kxsol(4);
kT15=kxsol(5);
kT22=kxsol(6);
kT23=kxsol(7);
kr23=kxsol(8);
kT31=kxsol(9);
kT32=kxsol(10);
kT33=kxsol(11);
kr32=kxsol(12);
T13(k)=kxsol(3);
T21(k)=kxsol(13);
T12(k)=kxsol(2);
T14(k)=kxsol(4);
T15(k)=kxsol(5);
T22(k)=kxsol(6);
T23(k)=kxsol(7);
r23(k)=kxsol(8);
T31(k)=kxsol(9);
T32(k)=kxsol(10);
T33(k)=kxsol(11);
r32(k)=kxsol(12);
end
figure;
plot(1:1:51, xsol);
title('xsol in funzione di t');
xlabe1=('t');
ylabe1=('xsol');
grid on;
figure;
plot(1:1:51, T11*180/pi);
title('T11 in funzione di t');
xlabe3=('t');
ylabe3=('T11');
grid on;
figure;
plot(1:1:51, T12*180/pi);
title('T12 in funzione di t');
xlabe4=('t');
ylabe4=('T12');
grid on;
figure;
plot(1:1:51, T13*180/pi);
title('T13 in funzione di t');
xlabe4=('t');
ylabe4=('T13');
grid on;
figure;
plot(1:1:51, T21*180/pi);
title('T21 in funzione di t');
xlabe2=('t');
ylabe2=('T21');
grid on;
figure;
plot(1:1:51, T23*180/pi);
title('T23 in funzione di t');
xlabe5=('t');
ylabe5=('T23');
grid on;
figure;
plot(1:1:51, r23);
title('r23 in funzione di t');
xlabe5=('t');
ylabe5=('r23');
grid on;
figure;
plot(1:1:51, T31*180/pi);
title('T31 in funzione di t');
xlabe6=('t');
ylabe6=('T31');
grid on;
figure;
plot(1:1:51, r32);
title('r32 in funzione di t');
xlabe6=('t');
ylabe6=('r32');
grid on;
function F=funz2(x)
T11=x(1);
T12=x(2);
T13=x(3);
T14=x(4);
T15=x(5);
T22=x(6);
T23=x(7);
r23=x(8);
T31=x(9);
T32=x(10);
T33=x(11);
r32=x(12);
T21=x(13);
F(1)=T12-T21;
F(2)=T31-T14;
F(3)=T13+T22-pi/2;
F(4)=T33-T22-pi;
F(5)=r23-(1+9-6*cos(T12+T13-1.5*pi))^(0.5);
F(6)=r32-(1+9-6*cos(pi-T14+T33))^(0.5);
F(7)=(5^(0.5))*cos(T11)+cos(T12)+4*cos(T13)+cos(T14)+(5^(0.5))*cos(T15)-8;
F(8)=(5^(0.5))*sin(T11)+sin(T12)+4*sin(T13)+sin(T14)+(5^(0.5))*sin(T15);
F(9)=cos(T21)+3*cos(T22)+r23*cos(T23);
F(10)=sin(T21)+3*sin(T22)+r23*sin(T23);
F(11)=cos(T31)+r32*cos(T32)+3*cos(T33);
F(12)=sin(T31)+r32*sin(T32)+3*sin(T33);
end

답변 (1개)

Matt J
Matt J 2019년 11월 20일
It means stopping criteria for the iterations were met. Fsolve cannot find a reason to continue.
  댓글 수: 2
Federico MegaMan
Federico MegaMan 2019년 11월 21일
Okay, thank you.
Another thing, the results aren't the expected, is there some reason for this? Maybe because there are cos and sin?
Matt J
Matt J 2019년 11월 21일
편집: Matt J 2019년 11월 21일
Perhaps your expectations (whatever those are) are incorrect.
Or, perhaps you have incorrectly implemented your equation function.
Or, perhaps you have given an insufficiently accurate initial guess.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by