You are on page 1of 4

Assignment #03

Submitted to:
Dr. Muhammad Abid

Submitted by:
Raheel Aslam

Subject:
Non Linear Control

Class:
MSSE (2021-2023)

Department of Electrical Engineering


Pakistan Institute of Engineering and Applied Sciences
Wrong Attempt Simulink Model:

As we can see the plot rather than converging to zero it goes towards infinity. At first when we
attempted this assignment the calculations done on the slides were slightly incorrect so we had
to recalculate it but still the results were still the same.
This graph was due to the value of 𝑥3 in 𝑢 which makes it approach towards infinity, the value
of 𝑥3 becomes almost zero as a result of which it approaches towards infinity rather than
converging to zero.
Correct Attempt Simulink Model:

So there were two methods to tackle with this issue, the first one was to add a small value in
the denominator with 𝑥3 so that it can avoid the graph from getting to infinity and hence
converge to zero, the second method was simply apply the built in saturation block so that it
can automatically avoid the graph from approaching towards infinity and get the graph to
converge to zero, So in our attempt we have used the second method of saturation block and as
we can see from the graph the output 𝑦 = 𝑥1 finally converges to zero as required.
Code for System Block:

function [x1_dot,x2_dot,x3_dot] = sys(x,u)


x1_dot=x(2);
x2_dot=9.81-0.01*x(2)-(x(3)^2)/(1+20*x(1))^2;
x3_dot=((1+(20*x(1)))/(0.03+(0.4*x(1))))*(-x(3)+((0.2*x(2)*x(3))/((1+20*x(1)^2)
))+u);
end

Code for Controller Block:

function u = controller(y)
ep = 1e-7;
z1=y(1);
z2=y(2);
z3=9.81-0.01*y(2)-((y(3)^2)/(1+20*y(1))^2);
v=-((1000*z1)+(300*z2)+(25*z3));
u=y(3)+((0.4*y(2)*y(3)+8*y(1)*y(2)*y(3))/(1+20*y(1))^2)-((1+20*y(1))*(0.03+0.4*
y(1))*v/(2*y(3)+ep));
end

You might also like