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

27 次查看(过去 30 天)
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.

回答(1 个)

Devineni Aslesha
Devineni Aslesha 2020-2-24
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]);

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by