how to substitute sym variables in jacobian matrix with numeric values?

32 vues (au cours des 30 derniers jours)
Nikhil Shriyan
Nikhil Shriyan le 20 Fév 2020
syms x y z
u = -Iscr + Iph - (x * ((exp((Iscr*y)/(n*Vth)))-1)) ...
- ((Iscr*y)/z);
v = Iph - (x * ((exp((Vocr)/(n*Vth)))-1)) - ((Vocr)/z);
w = -Im + Iph - (x * ((exp((Vm + Im*y)/(n*Vth)))-1))...
- ((Vm + (Im*y))/z);
a= jacobian([u;v;w],[x,y,z])
j=subs(a,[x,y,z],[xo,yo,zo]) %% This doesn't work, please explain why and also the alternative to this.

Réponses (1)

Devineni Aslesha
Devineni Aslesha le 24 Fév 2020
The ‘subs’ function works as expected. Please find the code shown below.
Iscr = 1;
Iph = 2;
Vth = 5;
n = 4;
Vocr = 3;
Im = 2;
Vm = 5;
syms x y z
u = -Iscr + Iph - (x * ((exp((Iscr*y)/(n*Vth)))-1)) ...
- ((Iscr*y)/z);
v = Iph - (x * ((exp((Vocr)/(n*Vth)))-1)) - ((Vocr)/z);
w = -Im + Iph - (x * ((exp((Vm + Im*y)/(n*Vth)))-1))...
- ((Vm + (Im*y))/z);
a = jacobian([u;v;w],[x,y,z]);
j = subs(a,[x,y,z],[1,2,3]);

Community Treasure Hunt

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

Start Hunting!

Translated by