q515.m

来自「这是matlab在电子信息课程中的应用」· M 代码 · 共 27 行

M
27
字号
%《MATLAB在电子信息课程中的应用》第五章例5.15程序q515
% 频率响应:二阶电路
% 电子工业出版社出版  陈怀琛 吴大正 高西全合著  2001年10月

clear, format compact
for Q=[1/3,1/2,1/sqrt(2),1,2,5]
   w=logspace(-1,1,50);			% 设定频率数组w
   H=1./(1+j*w/Q+(j*w).^2);		% 求复频率响应
   figure(1)
   subplot(2,1,1),plot(w,abs(H)),hold on	% 绘制幅频特性
   subplot(2,1,2),plot(w,angle(H)),hold on	% 绘制相频特性
   figure(2)				% 绘制对数频率特性
   subplot(2,1,1),semilogx(w,20*log10(abs(H))),hold on %纵坐标为分贝
   subplot(2,1,2),semilogx(w,angle(H)),hold on	% 绘制相频特性
end
figure(1)
subplot(2,1,1),   grid,xlabel('w'),ylabel('abs(H)')
axis([0,5,min(abs(H)),max(abs(H))])
subplot(2,1,2),   grid,xlabel('w'),ylabel('angle(H)')
axis([0,5,min(angle(H)),max(angle(H))])
figure(2)
subplot(2,1,1),   grid,xlabel('w'),ylabel('分贝')
subplot(2,1,2),   grid,xlabel('w'),ylabel('angle(H)')



⌨️ 快捷键说明

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