Error in 'new/S-Function' while executing MATLAB S-function 'model', flag = 0 (initialize), at start of simulation.

28 visualizzazioni (ultimi 30 giorni)
function [sys, x0] = model(t, x, u, flag)
F0 = 40;
T0 = 410;
CA0 = 0.5;
V = 48;
Vj = 3.85;
Fj = 49.9;
alpha = 7.08e10;
E = 30000;
R = 1.99;
U = 150;
A = 250;
Tj0 = 530;
lambda = -30000;
Cp = 0.75;
Cj = 1.0;
rho = 50;
rhoj = 62.3;
beta = U*A/(rhoj*Cj*Fj);
if flag == 0
x0(1) = CA0;
x0(2) = T0;
x0(3) = Tj0;
sys = [3 0 3 0 0 0];
elseif abs(flag) == 1
Ca = x(1);
T = x(2);
Tj = x(3);
k = alpha*exp(-E/(R*T));
sys = [F0*(CA0-Ca)/V - k*Ca; F0*(T0-T)/V - (lambda*k*Ca)/(rho*Cp) - (U*A*(T-Tj))/(rho*Cp*V); (Fj*(Tj0-Tj)/Vj)+(beta*Fj/Vj)*(T-Tj)];
elseif flag == 3
Ca = x(1);
T = x(2);
Tj = x(3);
sys = [Ca; T; Tj];
else
sys = [];
end
xguess=[0.4982;489.3;492.4158];
xs=trim('new',xguess);
end
I want to get the steady state near the xguess how should I do it?

Risposte (0)

Categorie

Scopri di più su General Applications in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by