⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 直流二阶过阻尼电路.m

📁 <matlab在电子信息中的应用>一书中个章节的配套源代码。
💻 M
字号:
%《MATLAB在电子信息课程中的应用》第五章例5.6程序q506
% 直流电路的暂态计算:二阶过阻尼电路
% 电子工业出版社出版  陈怀琛 吴大正 高西全合著  2001年10月

clear, format compact
L=0.5; R=12.5; C=0.02;		% 输入元件参数
uc0=1; iL0=0;
alpha=R/2/L; wn=sqrt(1/(L*C)); % 输入给定参数,这里ρ即α。
p1=-alpha+sqrt(alpha^2-wn^2)		 	  % 方程的两个根
p2=-alpha-sqrt(alpha^2-wn^2)
dt=0.01;t=0:dt:1;			  % 设定时间数组
% 方法1,用公式
uc1=(p2*uc0-iL0/C)/(p2-p1)*exp(p1*t);		% uc的第一个分量
uc2=-(p1*uc0-iL0/C)/(p2-p1)*exp(p2*t);		% uc的第二个分量
iL1=p1*C*(p2*uc0-iL0/C)/(p2-p1)*exp(p1*t);		% iL的第一个分量
iL2=-p2*C*(p1*uc0-iL0/C)/(p2-p1)*exp(p2*t);		% iL的第二个分量
uc=uc1+uc2; iL=iL1+iL2;									% 把两个分量相加
% 分别画出两种数据曲线
subplot(2,1,1),plot(t,uc),grid
subplot(2,1,2),plot(t,iL),grid
disp('方法2,用拉普拉斯变换及留数法')
pause
num=[uc0,R/L*uc0+iL0/C];		% uc(s)的分子系数多项式
den=[1,R/L,1/L/C];				% uc(s)的分母系数多项式
[r,p,k]=residue(num,den);		% 求极点留数
% 求时域函数ucn, 对ucn求导得到电流iLn
ucn=r(1)*exp(p(1)*t)+r(2)*exp(p(2)*t);	
iLn=C*diff(ucn)/dt;	%
% 绘曲线,注意求导后数据长度减少一个。
figure(2),subplot(2,1,1),
plot(t,ucn),grid	% 绘曲线
subplot(2,1,2)
plot(t(1:end-1),iLn),grid

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -