正在加载图片...
例12电路图见图1-3。R=149,L=2H,C=0.32F。初始状态:电感电流为零,电容 电压为0.5V。t=0时刻接入1伏的电压。求0<t<15秒时i(t)和vt的值,并且画出电流与 电容电压的关系曲线。 根据基尔霍夫定律[RLC]有 di Ri+L-+V。=V 1.4 0.32F 令 得 以上方程式在M文件 electsys.m中定义如下: function xdot= Felectsys(t,x),%状态导数 V=1; %阶跃输入 R=14:L=2:C=0.32 dot=x(2)C, 1/L *(V-x(1)-R*X(2))1 下面的M-文件使用函数ode23对系统进行仿真 t0=0 tfinal=15 时间间隔0~15秒 x0=[0.5,0 %初值条件x1=0.5,x2=0 tol=0.001; %精度 %若非零值则打印出每一步的计算值 It, x=ode23('electsys', to, tfinal, xO, tol, trace); subplot(211),plot(t, x); of a rlc series circuit) xlabel(Time-sec'") text(8, 1.05, Capacitor voltage,), text(8, 0.05, current) vc=x(:,1),=x(,2) subplot(2 12),plot( vc, 1); title('current versus capacitor voltage") xlabel(Capacitor Voltage,) ylabel(current') subplot(lll) 仿真结果见图1-4 33 例 1.2 电路图见图 1-3。R=1.4Ω,L=2H,C=0.32F。初始状态:电感电流为零,电容 电压为 0.5V。t=0时刻接入1伏的电压。求 0<t<15 秒时 i(t)和 v(t)的值,并且画出电流与 电容电压的关系曲线。 根据基尔霍夫定律[RLC]有: v0 vs dt di Ri L   和 dt dv i C 0  令 x v , x i 1  0 2  得 1 2 x C 1 x  (v x Rx ) L 1 x2  s  1 2  以上方程式在 M-文件 electsys.m 中定义如下: function xdot=electsys(t, x); %状态导数 V=1; %阶跃输入 R=1.4; L=2; C=0.32; xdot=[x(2)/C;1/L*(V-x(1)-R*x(2))]; 下面的 M-文件使用函数 ode23 对系统进行仿真。 t0=0;tfinal=15; ﹡时间间隔 0~15 秒 x0=[0.5,0]; %初值条件 x1=0.5,x2=0 tol=0.001; %精度 trace=0; %若非零值则打印出每一步的计算值 [t, x]=ode23('electsys',t0,tfinal,x0,tol,trace); subplot(211), plot(t, x); title('Time response of a RLC series circuit') xlabel('Time-sec') text(8,1.05,'Capacitor voltage'),text(8,0.05,'current') vc=x(:,1), i=x(:,2); subplot(212),plot(vc, i); title('current versus capacitor voltage') xlabel('Capacitor Voltage') ylabel('current') subplot(111) 仿真结果见图 1-4。 图 1-3
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有