Assignment 1 Solution
Assignment 1 Solution
Dynamic Equations
+ Equilibrium points:
𝑥𝑥1 = 𝜃𝜃 = 0
𝑥𝑥2 = 𝜃𝜃̇ = 0
𝑥𝑥3 = 𝑥𝑥� = 0
𝑥𝑥4 = 𝑥𝑥�̇ = 0
Or
b) Plot time response of 𝜃𝜃, 𝑥𝑥� with initial conditions 𝜃𝜃(0) = 0.76, 𝑥𝑥� = 0.2 (𝑚𝑚),
𝑟𝑟𝑟𝑟𝑟𝑟
𝜃𝜃̇(0) = 0 ; 𝑥𝑥�̇ (0) = 0 𝑚𝑚/𝑠𝑠. (see MATLAB code file in Appendix I)
𝑠𝑠
2
dot
1.5
0.5
(t)(degree)
-0.5
-1
-1.5
-2
-2.5
0 2 4 6 8 10 12 14 16 18 20
time t
t vs x_2(t) and t vs \dot{x(t)}
0.8
\x_1(t)
0.6 \x_1(t)_{dot}
0.4
0.2
x (t)(m/s)
0
2
-0.2
-0.4
-0.6
-0.8
0 2 4 6 8 10 12 14 16 18 20
time t
Problem 2: Equation of motion for this simple pendulum
Where I = m𝑙𝑙 2
a) Write out a linearized model about the equilibrium (θ, 𝜃𝜃̇) = (0, 0)
b) Plot time response of the linearized model of initial condition (𝜃𝜃 = 200
degree, 𝜃𝜃̇ = 0)
c) Design a stabilizing control law and plot time response of the achieved
control. (you are supposed to assign desied poles in this problem)
Solution:
d) Write out a linearized model about the equilibrium (θ, 𝜃𝜃̇) = (0, 0)
• By putting 𝑥𝑥1 = 𝜃𝜃, 𝑥𝑥2 = 𝜃𝜃̇, state equations
𝑥𝑥̇ 1 = 𝑥𝑥2
−𝑔𝑔 𝑇𝑇𝑐𝑐
𝑥𝑥̇ 2 = 𝑠𝑠𝑠𝑠𝑠𝑠𝑥𝑥1 + 2
𝑙𝑙 𝑚𝑚𝑙𝑙
• Linearized model at equilibrium (θ, θ ̇) = (0, 0)
0 1 𝑥𝑥 0
𝑥𝑥̇
� 1 � = �−𝑔𝑔
1
1
𝑥𝑥̇ 2 0� �𝑥𝑥2 � + � 2 � 𝑢𝑢
𝑙𝑙 𝑚𝑚𝑙𝑙
0.3
0.25
0.2
0.15
Radian
0.1
0.05
-0.05
-0.1
-0.15
0 5 10 15
Time,sec
Time resposne of \theta_{\dot}y(2):
0.8
0.6
0.4
0.2
Rad/s
-0.2
-0.4
-0.6
-0.8
0 5 10 15
Time,sec
f) Design a stabilizing control law and plot time response of the achieved
control.
Select desired poles (desired pole = [-2+3.1622i -2-3.1622i]) such that we
achieve higher feedback gains (k_1=4.1995; k_2=4.00). Step response in
numerical simulation.
Step Response
From: In(1) From: In(2)
1.2
0.8
Amplitude
0.6
0.4
0.2
0
0 1 2 3 0 1 2 3
Time (seconds)
---END---
% Control Engineering II
% Created by Thanh Tran
% Assignment 1
% date November 7, 2019
% ==============================================
clc
clear
close all
options = odeset('MaxStep',0.01);
[t,y] = ode45(@pendulum,[0 20],[0.76;0.0;0.2;0.0],options);
figure(2);
plot(t,y(:,3)),
hold on
plot(t,y(:,4)),
grid on
xlabel('time t');
ylabel('x_2(t)(m/s)');
title('t vs x_2(t) and t vs \dot{x(t)}');
legend('\x_1(t)','\x_1(t)_{dot}')
% ================
% Define dynamic Equations
function dydt = pendulum(t,y)
l=1; %(m),
m = 1; % kg,
mm = 5; % kg,
g = 9.82; % N/s^2,
k = 1; % N/m
dydt = zeros(4,1);
%
dydt(1) = y(2);
dydt(2) = term_1/term_2 -(g*sin(y(1))/l);
dydt(3) = y(4);
dydt(4) = term_3/term_2 ;
end
% Eng of the program