MATLAb Solve function not solving
Afficher commentaires plus anciens
I am trying to solve a system of equations in Matlab, however when I run the code below, it doesn't return an answer for I1, I2 and V0, although there 3 equations and 3 variables. I need some help.
clear all
close all
syms I1 I2 V0
s=2;
eqns=[5*I1+4*I2+1/(s*0.1)*I1+2*s*I1==1, 4*I2-3*V0==0, V0==I1*(2*s)];
S=solve(eqns,[I1,I2,V0])
Réponse acceptée
Plus de réponses (3)
Which MATLAB version are you using ? R2024b gives a direct answer:
clear all
close all
syms I1 I2 V0
s=2;
eqns=[5*I1+4*I2+1/(s*0.1)*I1+2*s*I1==1, 4*I2-3*V0==0, V0==I1*(2*s)];
S=solve(eqns,[I1,I2,V0])
Star Strider
le 21 Oct 2024
Modifié(e) : Star Strider
le 21 Oct 2024
Your code works in R2024b —
clear all
close all
syms I1 I2 V0
s=2;
eqns=[5*I1+4*I2+1/(s*0.1)*I1+2*s*I1==1, 4*I2-3*V0==0, V0==I1*(2*s)];
S=solve(eqns,[I1,I2,V0])
format long
I1 = double(S.I1)
I2 = double(S.I2)
V0 = double(S.V0)
Consider upgrading, if that is an option. (I no longer have access to R2019a to see if there could be a work-around.)
EDIT — Changed vpa calls to double, since symbolic results no longer appear here after a post is submittted.
.
Seems to work fine here
clear all
close all
syms I1 I2 V0
s=2;
eqns=[5*I1+4*I2+1/(s*0.1)*I1+2*s*I1==1, 4*I2-3*V0==0, V0==I1*(2*s)];
S=solve(eqns,[I1,I2,V0])
Catégories
En savoir plus sur Common Operations 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!