q516.m

来自「MATLAB及在电子信息课程中的应用,电子工业出版社出版 陈怀琛 吴大正 高西全」· M 代码 · 共 29 行

M
29
字号
%《MATLAB及在电子信息课程中的应用》第五章例5.16程序q516
% 频率响应:二阶电路
% 电子工业出版社出版  陈怀琛 吴大正 高西全合著 2001年10月初版,2003年7月第二版
%
H0=1;w0=1;
for Q=[5,10,20,50,100]
    w=logspace(-1,1,50);			        % 设定频率数组w
    H=H0./(1+j*Q*(w/w0-w0./w));		        % 求复频率响应
    figure(1) 			                    % 横坐标为线性坐标绘制频率特性
    set(gcf,'color','w')                    % 设置图形背景色为白色
    subplot(2,1,1),plot(w,abs(H)),hold on	% 绘制幅频特性
    subplot(2,1,2),plot(w,angle(H)),hold on	% 绘制相频特性
    figure(2)							    % 绘制对数频率特性
    set(gcf,'color','w')                    % 设置图形背景色为白色
    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)')
subplot(2,1,2),   grid,xlabel('w'),ylabel('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 + -
显示快捷键?