figure31.m
来自「《嵌入式控制系统及其CC++实现-面向使用Matlab的软件开发者》源码」· M 代码 · 共 33 行
M
33 行
% Embedded Control Systems in C/C++
% by Jim Ledin
%
% Figure 3.1
% This M-file requires the Control System Toolbox
clear all
close all
% Create a linear system
b = 100;
a = [1 1.8 100];
sys = tf(b, a);
% Compute the magnitude and phase of the response
w = logspace(0, 2, 1000);
[mag, phase, w] = bode(sys, w);
mag = mag(:);
phase = phase(:);
% Plot the magnitude
subplot(211)
semilogx(w, 20*log10(mag), 'k')
grid on
ylabel('Magnitude, dB')
% Plot the phase
subplot(212)
semilogx(w, phase, 'k')
grid on
ylabel('Phase, degrees')
xlabel('Frequency, rad/sec')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?