1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
function xdot=system(t,x,Ex)
% calcul xdot=f(t,x)
% t est le temps
% x est le vecteur d'etat (x=(Tm, Ti, V)')
% Ex est la matrice qui vient d'excel (N lignes, 2 colonnes)
% quelques constantes
A=1; B=1; C=1; D=1; E=1; F=1; G=1;
% la sortie doit etre un vecteur colonne
xdot=zeros(size(x,1),1);
% quelques variables temporaires
index=min(abs(t-Ex(:,1)));
Ta=Ex(index,2);
P=F*(20.-x(2))+G*x(3)/x(2);
xdot(1)=(B*(x(1)-Ta)+C*(x(2)-x(1)))/A;
xdot(2)=(P-E*(x(2)-x(1)))/D;
xdot(3)=20.-x(2); |
Partager