Disturbance Rejection with PID turner

1 view (last 30 days)
I'm trying to do a disturbance rejection with PID tuner.I'm trying to do it but it keeps giving error.Could you help me?
G=tf([1],[0.1 1]);
G.InputName='yzad';
G.Output='ys';
yzad={1,10,100}
K={-100,-10,1,5,3}
Sum=sumbkl('++','yzad','ys')
ISAPID=connect('-100','Sum','G')
tf(ISAPID)
You can find my diagram attached .Thanks

Accepted Answer

Sam Chak
Sam Chak on 25 Jun 2022
For simplicity, you can do something straightforward and plot the time responses like this.
Case 1a: , rad/s
% sin(omega*t) = sin((2π*Freq)*t) = sin((2π/τ)*t)
omega = 1; % angular frequency {1, 10, 100} rad/s
tau = 2*pi/omega; % time period of a wave
Tf = 2*tau; % wave duration of Tf seconds
[u, t] = gensig("sine", tau, Tf); % generates a signal where t runs from 0 to Tf seconds
G = tf(1, [0.1 1]); % plant transfer function
K = -100; % feedback gain {-100, -10, -1, 5, 3}
H = -K;
Gcl = feedback(G, H) % closed-loop system subjected to a disturbance Y(s)/D(s)
Gcl = 1 ----------- 0.1 s + 101 Continuous-time transfer function.
lsim(Gcl, u, t)
grid on
Case 1b: , rad/s
% sin(omega*t) = sin((2π*Freq)*t) = sin((2π/τ)*t)
omega = 10; % angular frequency {1, 10, 100} rad/s
tau = 2*pi/omega; % time period of a wave
Tf = 2*tau; % wave duration of Tf seconds
[u, t] = gensig("sine", tau, Tf); % generates a signal where t runs from 0 to Tf seconds
G = tf(1, [0.1 1]); % plant transfer function
K = -100; % feedback gain {-100, -10, -1, 5, 3}
H = -K;
Gcl = feedback(G, H) % closed-loop system subjected to a disturbance Y(s)/D(s)
Gcl = 1 ----------- 0.1 s + 101 Continuous-time transfer function.
lsim(Gcl, u, t)
grid on
Case 1c: , rad/s
% sin(omega*t) = sin((2π*Freq)*t) = sin((2π/τ)*t)
omega = 100; % angular frequency {1, 10, 100} rad/s
tau = 2*pi/omega; % time period of a wave
Tf = 2*tau; % wave duration of Tf seconds
[u, t] = gensig("sine", tau, Tf); % generates a signal where t runs from 0 to Tf seconds
G = tf(1, [0.1 1]); % plant transfer function
K = -100; % feedback gain {-100, -10, -1, 5, 3}
H = -K;
Gcl = feedback(G, H) % closed-loop system subjected to a disturbance Y(s)/D(s)
Gcl = 1 ----------- 0.1 s + 101 Continuous-time transfer function.
lsim(Gcl, u, t)
grid on
Case 2a: , rad/s
% sin(omega*t) = sin((2π*Freq)*t) = sin((2π/τ)*t)
omega = 1; % angular frequency {1, 10, 100} rad/s
tau = 2*pi/omega; % time period of a wave
Tf = 2*tau; % wave duration of Tf seconds
[u, t] = gensig("sine", tau, Tf); % generates a signal where t runs from 0 to Tf seconds
G = tf(1, [0.1 1]); % plant transfer function
K = -10; % feedback gain {-100, -10, -1, 5, 3}
H = -K;
Gcl = feedback(G, H) % closed-loop system subjected to a disturbance Y(s)/D(s)
Gcl = 1 ---------- 0.1 s + 11 Continuous-time transfer function.
lsim(Gcl, u, t)
grid on

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!