RLC电路放电过程的MATLAB代码

发布时间 : 星期一 文章RLC电路放电过程的MATLAB代码更新完毕开始阅读

C=1e-7; R=1050; tau=R*C;

x1=0:0.00002:0.0005; x2=0.0005:0.00002:0.001; y1=0.8*(1-exp(-x1/tau));

y2=0.8*(exp(-(x2-0.0005)/tau))-(0.8-0.8*(1-exp(-0.0005/tau))); x=[x1,x2]; y=[y1,y2]; plot(x,y) hold on

a1=0:0.00002:0.0005; a2=0.0005:0.00002:0.001; S=5000; tav=S*C;

b1=0.8*(1-exp(-a1/tav));

b2=0.8*(exp(-(a2-0.0005)/tav))-(0.8-0.8*(1-exp(-0.0005/tav))); a=[a1,a2]; b=[b1,b2]; plot(a,b,'r') hold on

c1=0:0.00002:0.0005; c2=0.0005:0.00002:0.001; T=7000; taw=T*C;

d1=0.8*(1-exp(-c1/taw));

d2=0.8*(exp(-(c2-0.0005)/taw))-(0.8-0.8*(1-exp(-0.0005/taw))); c=[c1,c2]; d=[d1,d2];

>> plot(c,d,'g') >> grid on

>> axis([0 0.001 0 0.8]) >> xlabel('Time, s')

>> ylabel('The voltage of the capacitor, V') >> title('Simulation circuit transient of RC') >> text(0.0004,0.76,'R=1050') >> text(0.0004,0.42,'R=5000') >> text(0.0004,0.33,'R=7000')

format compact

>> L=0.2;C=1e-7;R=500; >> uc0=8;iL0=0;

alpha=R/(2*L);w0=sqrt(1/(L*C)); s1=-alpha+sqrt(alpha^2-w0^2); s2=-alpha-sqrt(alpha^2-w0^2); >> dt=0.00001;t=0:dt:0.01;

>> uc1=(s2*uc0-iL0/C)/(s2-s1)*exp(s1*t)-(s1*uc0-iL0/C)/(s2-s1)*exp(s2*t); subplot(2,1,1),plot(t,uc1),grid; xlabel('Time, s')

>> ylabel('The voltage of the capacitor, V')

>> title('Simulation circuit transient of RLC—Low damping state')

format compact

>> L=0.2;C=1e-7;R=10050; >> uc0=8;iL0=0;

alpha=R/(2*L);w0=sqrt(1/(L*C)); s1=-alpha+sqrt(alpha^2-w0^2); s2=-alpha-sqrt(alpha^2-w0^2); >> dt=0.00001;t=0:dt:0.01;

>> uc1=(s2*uc0-iL0/C)/(s2-s1)*exp(s1*t)-(s1*uc0-iL0/C)/(s2-s1)*exp(s2*t); subplot(2,1,1),plot(t,uc1),grid; xlabel('Time, s')

>> ylabel('The voltage of the capacitor, V')

>> title('Simulation circuit transient of RLC—Overdamping state')

联系合同范文客服:xxxxx#qq.com(#替换为@)