我想编写一个脚本来绘制带通滤波器的传递函数[H(f)]的图形,| H(f)| 反对频率和H(f)(度)相对于频率的相位,我对matlab非常新,所以语法不是100%,我很困惑,因为一切都是以矩阵形式自动格式化.下面是我的脚本:
% RCL circuit: band-pass filter
R=55590; L=0.9571; C=48.811*10.^(-9); % values of the Resistor and Capacitor
f=(0:60e3); w=2*pi*f; % frequency (f) range of measurements
H=(R./(sqrt(R^2+(w*L-(1./(w*C))).^2))); % Transfer Function
% Magnitude (absolute value) of the transfer function
plot(f,abs(H),'LineWidth',2); grid on; hold on
xlabel('Frequency [Hz]','FontSize',20); ylabel('|H(f)|','FontSize',20)
Run Code Online (Sandbox Code Playgroud)
数字
plot(f,angle(H)*180/pi,'LineWidth',2); grid on; hold on
xlabel('Frequency [Hz]','FontSize',18);
ylabel('phase of H(f) [degrees]','FontSize',20)
Run Code Online (Sandbox Code Playgroud)
这是我使用的传递函数公式
下面是我的实验结果和预期图表的另一张图片,我只是不明白为什么MATLAB没有绘制我想要的东西?
