fsolve non-linear equation system

0

It does not work for me. It seems that I do not know how to use the fsolve. It stops after the first iteration giving illogical results.

%% parámetros
a=2.07E-05;
n=0.75;
m=0.2;
rho_O2=1180;
L=1:30;
mox=0.030259;


%% variables iniciales
D0(1:length(L))=0.01;
x=(1:length(L))*1E-2;
mox0(1:length(L))=0;
for i=1:length(L)
    A0(i)=pi*(D0(i)/2)^2;
    S0(i)=pi*D0(i)*x(i);
    r0(i)=0;
    mf0(i)=r0(i)*S0(i)*rho_O2;
    mT0(i)=mf0(i)+mox0(i);
    rhoV0(i)=mT0(i)/A0(i);
    OF0(i)=mox0(i)/mf0(i);
end
    D(1,:)=D0';
    A(1,:)=A0';
    S(1,:)=S0';
    r(1,:)=r0';
    mf(1,:)=mf0';
    mT(1,:)=mT0';
    rhoV(1,:)=rhoV0';
    OF(1,:)=OF0';
%% regresion
x0=[r0 mf0 mT0 rhoV0]
for t=2:20
    for i=1:length(L)
        D(t,i)=D(t-1,i)+2*r(t-1,i);
        A(t,i)=pi*(D(t,i)/2)^2;
        S(t,i)=pi*D(t,i).*x(i);
        xx=[r mf mT rhoV];
        F=@(xx)[xx(1)-((a/(x(i)^m))*xx(4)^n);
            xx(2)-(xx(1)*S(t,i)*rho_O2);
            xx(3)-(xx(2)+mox);
            xx(2)-(xx(3)/A(t,i))];
        options = optimset('TolX',1e-8);
        [xx,exitflag]=fsolve(F,x0,options);
    
asked by Nabil Iben Sobih Vázquez 09.05.2018 в 19:58
source

0 answers