Jacobian matrix evaluation doubt!
Afficher commentaires plus anciens
Is there a way to evaluate a jacobian matrix having symbolic variables that change with every time step? Here is the code that I am running:
syms yA yG yC
k1 = 1;
k2 = 1;
k3 = 1;
k0 = k1 + k3;
f = [(-k1-k3)*(yA^(2)); (k1*(yA^(2))) - (k2*yG); (k3*(yA^(2))) + (k2*yG)];
v = [yA yG yC];
J = jacobian(f,v);
t = 0:0.1:10;
yA = 1./(1 + (k0*t));
eta = k2./(k0*yA);
a = (k1*k2)/(k0^(2));
yG = a*exp(-eta).*(((k0/k2)*exp(k2/k0)) - (exp(eta)./eta) + mfun('Ei',eta) - mfun('Ei',k2/k0));
yC = 1-yG-yA;
for i = 1:length(t)
j = J([yA(i) yG(i) yC(i)]);
%j = subs(J, [yA yG yC], [1 0 0]);
lambda = eig(j);
r = double(lambda); %converts a symbolic matrix to a matlab numeric form
b(i) = max(abs(r));
c(i) = min(abs(r));
SR(i) = b(i)./c(i);
end
This line: j = J([yA(i) yG(i) yC(i)]); is not being evaluated properly? Am I wrong somewhere?
Thank you for the help!
Regards
Ushnik
Réponses (0)
Catégories
En savoir plus sur Dynamic System Models dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!