MATLAB在电路中的应用 下载本文

eaintheaccidentinvestigation,managementandreporting,eachpostshouldbedevelopedunderthissystemspecialistscheck,cleartheexaminatons,time,cyclesandotherrelevantregulations.Strengtheningsitesupervisionandexamination,todetectandinvestigateillegalcommand,illegaloperationsandviolationsofoperatingrules.Secondsafetyreferstotheproductionsite,technologymanagement,equipment,facilities,andsooncanleadtoaccidentsrisksexist.1,accordingtotheextentofthesecurityrisks,solvingisdividedintoa,b,andclevelsofdifficulty;A-level:difficult,miningdifficulties,shallbereportedtothecompany'sproblems.B-class:difficulttoresolvedif图2

解:①建模。如图2,建立网孔电流方程: (R1+jwL1)I1 + jwMI2 = US jwMI1 + (R2+jwL2+RL)I2= 0 ②利用MATLAB编程: clear,format compact % 输入元件参数值

R1=20;R2=0.08;RL=42;L1=3.6 ;L2=0.06; M =0. 4650;w=10 *pi;Us=115; % 按Z*X=Y 列写电路的矩阵方程,其中 X=[I1; I2]

z11=R1+j *w*L1;z12=j*w*M; z21=j*w*M; z22=R2+j*w*L2+RL; %以上设置系数矩阵X的元素

Z=[z11 , z12 ; z21 , z22];Y=[Us ; 0]; X=Z \\Y ; %求解结果 I1=X(1);I2=X(2); I1,I2 ,%输出结果

r1=abs (I1), angle1=[angle (I1 ) * 180]/pi, r2=abs (I2), angle2=[angle (I2 ) * 180]/pi 运行程序得:I1 =0.0470 - 0.1000 , I2 = -0.3501 - 0.0063I; r1 = 0.1105,angle1 = -64.8385; r2 = 0.3502,angle2 = -178.9683

上式中r1, r2分别代表电流I1,I2的模,angle1, angle2分别代表电流I1,I2的辐角。 1.2 动态电路分析

描述动态电路是用微分方程,一阶动态电路是一阶微分方程来描述的,可以直接求解微分方程,但也可以应用三要素法求解。当应用三要素法求解时,电路

iculties,shallconsistofminingorganizationstosolveproblems.C-class:fromsegmentsandbusinessrisksthatmustbeaddressedintheDepartment.2,open-pitmineunsafetypesinclude:electrical,transport,blasting,fire,andotherslope.3,accordingtotheseverityofthehazardfilledinbyunittroubleshooting,registrationform(seeatteaintheaccidentinvestigation,managementandreporting,eachpostshouldbedevelopedunderthissystemspecialistscheck,cleartheexaminations,time,cyclesandotherrelevantregulations.Strengtheningsitesupervisionandexamination,todetectandinvestigateillegalcommand,illegaloperationsandviolationsofoperatingrules.Secondsafetyreferstotheproductionsite,technologymanagement,equipment,facilities,andsooncanleadtoaccidentsrisksexist.1,accordingtotheextentofthesecurityrisks,solvingisdividedintoa,b,andclevelsofdifficulty;A-level:difficult,miningdifficulties,shallbereportedtothecompany'sproblems.B-class:difficulttoresolvedif的全响应=零输入响应+零状态响应,或者电路的全响应=稳态响应+暂态响应,用公式表示为f ( t)= [f (∞)-f (0+)]exp(-t /τ)+ f (∞),该式作为其数学模型。二阶动态电路用二阶微分方程来描述,要应用拉氏变换来建立S域的数学模型,限于篇幅仅以一阶电路为例运用MATLAB进行分行计算。

例 :如图3所示电路,已知R=2Ω,C=0.5F,电容初始电压Uc (0+)=4V,激励为正弦电压US (t)=8cos4t,当t=0时,开关S闭合,求电容电压的全部响应,并绘出波形图。

图3

解:①建模。当t≥0时,表征电容电压的微分方程为: dUc /dt+Uc /RC=US /RC 若用三要素法求解,其解为:

Uc(t)=Uc(∞) +[Uc(0+)-Uc(∞)] exp(- t/τ)式中,Uc(0)为电容的初始电压,Uc(∞)为电容的稳态值,τ为时间常数。但由于激励为正弦电压, 上述公式适当修改为:

Uc(t)=Ucp(t) + [Uc(0+)- Ucp(0+)] exp(-t /τ)式中,Ucp(t)为电容的稳态值, 它应是和电源同频率的正弦电压,只是其幅值和相位不同,记为Ucp(t)=Ucpm * cos(ωt +θ), U cp(0+)为 0+时刻的Ucp(t)值,即Ucp(0+)=Ucpm * cos(θ)。 ②编程。 clear all

R=2; C= 0.5;T =R * C; Uc0=4;%输入元件参数 Usm=8; w=4; Zc=1/(j * w * C); t=0:0.1:10;

Us=Usm * cos(w * t);%输入激励信号 Ucp=Us * Zc/(R+Zc);%计算稳态分量 Ucp0=Ucp(1);%计算稳态分量的初始值

iculties,shallconsistofminingorganizationstosolveproblems.C-class:fromsegmentsandbusinessrisksthatmustbeaddressedintheDepartment.2,open-pitmineunsafetypesinclude:electrical,transport,blasting,fire,andotherslope.3,accordingtotheseverityofthehazardfilledinbyunittroubleshooting,registrationform(seeatteaintheaccidentinvestigation,managementandreporting,eachpostshouldbedevelopedunderthissystemspecialistscheck,cleartheexaminatons,time,cyclesandotherrelevantregulations.Strengtheningsitesupervisionandexamination,todetectandinvestigateillegalcommand,illegaloperationsandviolationsofoperatingrules.Secondsafetyreferstotheproductionsite,technologymanagement,equipment,facilities,andsooncanleadtoaccidentsrisksexist.1,accordingtotheextentofthesecurityrisks,solvingisdividedintoa,b,andclevelsofdifficulty;A-level:difficult,miningdifficulties,shallbereportedtothecompany'sproblems.B-class:difficulttoresolvedifUct=[Uc0-Ucp0 ]* exp(-t/T);%计算暂态分量 Uc=Uct+Ucp;%计算电路的全响应

plot (t ,Uc,'-g',t,Uct,'+r',t,Ucp,'* b' ),grid% 绘制 稳态分量,暂态分量,全响应的波形图(如图4) legend('Uc','Uct','Ucp')%波形注释

运行程序,得到仿真结果:

Uc:电路的全响应 Uct:电路的暂态分量 Ucp:电路的稳态分量

2 小结

电路分析的基本方法是建立数学模型(一般是方程或者已知电路方程组),并求解方程组,得到各支路电压和电流。当电路规模较大时,求解很复杂,借助计算机可以大大简化计算量,以前有FORTRAN和BASIC语言编写的程序,但一般程序较大,较复杂,而利用MATLAB则要简单得多,而且还可以进行仿真,除编写专用程序外,可以建立通用的电路分析程序。以上三个题例,均是采用编程的方式,其实也可以用MATLAB的命令方式求解,这样更简单。 参考文献:

[1] 邱关源.电路(第四版)[M].北京:高等教育出版社,1999.

iculties,shallconsistofminingorganizationstosolveproblems.C-class:fromsegmentsandbusinessrisksthatmustbeaddressedintheDepartment.2,open-pitmineunsafetypesinclude:electrical,transport,blasting,fire,andotherslope.3,accordingtotheseverityofthehazardfilledinbyunittroubleshooting,registrationform(seeatteaintheaccidentinvestigation,managementandreporting,eachpostshouldbedevelopedunderthissystemspecialistscheck,cleartheexaminations,time,cyclesandotherrelevantregulations.Strengtheningsitesupervisionandexamination,todetectandinvestigateillegalcommand,illegaloperationsandviolationsofoperatingrules.Secondsafetyreferstotheproductionsite,technologymanagement,equipment,facilities,andsooncanleadtoaccidentsrisksexist.1,accordingtotheextentofthesecurityrisks,solvingisdividedintoa,b,andclevelsofdifficulty;A-level:difficult,miningdifficulties,shallbereportedtothecompany'sproblems.B-class:difficulttoresolvedif[2] 周金萍等.MATLAB6实践与提高[M].北京:中国电力出版社,2001. [3] 陈怀琛等.MATLAB及在电子信息课程中的应用[M].北京:电子工业出版社,2002.

iculties,shallconsistofminingorganizationstosolveproblems.C-class:fromsegmentsandbusinessrisksthatmustbeaddressedintheDepartment.2,open-pitmineunsafetypesinclude:electrical,transport,blasting,fire,andotherslope.3,accordingtotheseverityofthehazardfilledinbyunittroubleshooting,registrationform(seeatt