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

📄 q507.m

📁 《MATLAB在电子信息课程中的应用》中的第五章的习题源程序
💻 M
字号:
%《MATLAB在电子信息课程中的应用》第五章例5.7程序q507
% 直流电路的暂态计算:二阶欠阻尼电路
% 电子工业出版社出版  陈怀琛 吴大正 高西全合著  2001年10月

clear, format compact
L=0.5; C=0.02; R=12.5;		% 输入元件参数
uc0=1; iL0=0;
for R=1:10
   a=R/2/L;; w0=sqrt(1/(L*C)); % 输入给定参数
   a1=a-sqrt(a^2-w0^2);		% 方程的两个根
   a2=a+sqrt(a^2-w0^2);
   dt=0.01;t=0:dt:1;				% 设定时间数组
   % 方法1,用公式
   uc1=(a2*uc0+iL0/C)/(a2-a1)*exp(-a1*t);		% uc的第一个分量
   uc2=-(a1*uc0+iL0/C)/(a2-a1)*exp(-a2*t);		% uc的第二个分量
   iL1=-a1*C*(a2*uc0+iL0/C)/(a2-a1)*exp(-a1*t);		% iL的第一个分量
   iL2=a2*C*(a1*uc0+iL0/C)/(a2-a1)*exp(-a2*t);		% iL的第二个分量
   uc=uc1+uc2; iL=iL1+iL2;							% 把两个分量相加
   % 分别画出两种数据曲线
   figure(1),plot(t,uc),hold on
   figure(2),plot(t,iL),hold on
end
   figure(1),grid,figure(2),grid
% 方法2,用拉普拉斯变换及留数法
for R=1:9
   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=r(1)*exp(p(1)*t)+r(2)*exp(p(2)*t);	% 求时域函数
   iLn=C*diff(ucn)/dt;			% 对ucn求导得到电流iLn
   figure(3),plot(t,ucn),grid,hold on		% 绘曲线
   figure(4),plot(t(2:end),iLn),grid,hold on
end 
figure(3),grid,figure(4),grid

⌨️ 快捷键说明

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