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!