Berikut ini adalah script MATLAB untuk analisis closed-loop dengan Bode plot diagram.
clear all, close all, clc;
%% Define the system
num = 1;
den = [1 3 5 7];
P = tf(num,den);
% define the plant
Kp = 3;
Ki = 5;
Kd = 7;
K = tf([Kd Kp Ki],[1 0])
% define the PID controller
CL = feedback(series(K,P),1)
% closed-loop system (CL)
%% Bode analysis
[Gm1,Pm1,Wcg1,Wcp1] = margin(P)
% Gain margin and Phase margin of the plant
% Gm1 = 8.0004
% Pm1 = inf
[Gm2,Pm2,Wcg2,Wcp2] = margin(CL)
% Gain margin and Phase margin of CL
% Gm2 = Inf
% Pm2 = 93.3738
bode(P),grid
hold on
bode(CL)
legend('Plant','Closed-loop system')
%% Define the system
num = 1;
den = [1 3 5 7];
P = tf(num,den);
% define the plant
Kp = 3;
Ki = 5;
Kd = 7;
K = tf([Kd Kp Ki],[1 0])
% define the PID controller
CL = feedback(series(K,P),1)
% closed-loop system (CL)
%% Bode analysis
[Gm1,Pm1,Wcg1,Wcp1] = margin(P)
% Gain margin and Phase margin of the plant
% Gm1 = 8.0004
% Pm1 = inf
[Gm2,Pm2,Wcg2,Wcp2] = margin(CL)
% Gain margin and Phase margin of CL
% Gm2 = Inf
% Pm2 = 93.3738
bode(P),grid
hold on
bode(CL)
legend('Plant','Closed-loop system')
Berikut ini ialah Bode plot diagram.
Lihat juga tentang.
Kendali state space MATLAB.
- State space controlability and observability.
- State space to transfer function.
- Pole-placement.
- Linear-Quadratic Regulator.
- Bode plot diagram state space.
Untuk penjelasan tentang Bode plot dapat dilihat pada artikel berikut.