Substatuting numbers in dsolve
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
The following is a program to solve a second order differential equation using dsolve. I would like to be able to vary the parameters of the RLC circuit that the programs solves. How do I get this program to run?
clc clear all close syms R1 R2 C L Vc0 iL0 R1 = 10; R2 = 8; C = 1/8; L = 2; Vc0 = 1; iL0 = 0.5;
V = dsolve('D2x + (1/L*C)*(L/R2+R1*C)*Dx + (1/L*C)*((R1+R2)/R2)*x = 0','Dx(0) = iL0/C-Vc0/(C*R2)','x(0) = 1') Vf = subs(I,{R1,R2,C,L,Vc0,iL0},{10,8,1/8,2,1,0.5})
1 commentaire
Andrei Bobrov
le 22 Août 2011
syms R1 R2 C L Vc0 iL0
V = dsolve('D2x + (1/L*C)*(L/R2+R1*C)*Dx + (1/L*C)*((R1+R2)/R2)*x = 0','Dx(0) = iL0/C-Vc0/(C*R2)','x(0) = 1')
subs(V,{R1,R2,C,L,Vc0,iL0},{10,8,1/8,2,1,0.5})
Réponses (1)
Andrei Bobrov
le 22 Août 2011
variant
syms R1 R2 C L Vc0 iL0
V = dsolve('D2x + (1/L*C)*(L/R2+R1*C)*Dx + (1/L*C)*((R1+R2)/R2)*x = 0','Dx(0) = iL0/C-Vc0/(C*R2)','x(0) = 1')
1.
Vw = vpa(subs(V,{R1,R2,C,L,Vc0,iL0},{10,8,1/8,2,1,0.5}),5);
2.
G = matlabFunction(V);
Vw = G(10,8,1/8,2,1,0.5,sym('t'))
0 commentaires
Voir également
Catégories
En savoir plus sur Formula Manipulation and Simplification dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!