Jacobian matrix evaluation doubt!

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

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Dynamic System Models 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by