Substatuting numbers in dsolve
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Andrei Bobrov
2011 年 8 月 22 日
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})
回答 (1 件)
Andrei Bobrov
2011 年 8 月 22 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!