solving rlc circuit using ode45
Mostra commenti meno recenti
i have homework to solve rlc circuit using ode45 i tried this code and the question is how to plot Vl1 anyone can help me please and if there is any mistake in this code
function RLC=homework(t,x)
R1=20;R2=30;L1=4*10^-3;L2=2*10^-3;C=0.004;u=100;
RLC(1)=(R1/L1)*(x(1))+(1/L1)*(x(2))-(1/L1)*u;
RLC(2)=-(R2/L2)*(x(2))+(1/L2)*(x(3));
RLC(3)=(-1/C)*(x(1))-(1/C)*(x(2));
RLC=RLC';

[t,x]=ode45('homework',[0 10],[2;2;2]);
2 Commenti
James Tursa
il 8 Ago 2018
You are missing a minus sign on the first rhs term on the x1dot line:
RLC(1) = -(R1/L1)*(x(1)) + (1/L1)*(x(2)) - (1/L1)*u;
sami alzeq
il 9 Ago 2018
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Mathematics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!