MATLAB: Having a system of three state I put the odes in a function and the script to solve the given function but now it is executing continuously, so tell me how to stop it

ode 45terminal sliding mode

function xdot=func4(t,x)
A=[0 1 0;0 0 1;-1 -2 -3]
B=[0 0;0 1;1 0]
C1=[0 1]'
C2=[1 0 ;0 1]
C3=[1 0]'
s=[C1*x(1)+C2*[x(2);x(3)]+C3*x(1)^(3/4)]
u1=[1;0]*x(1)+[1 3;0 -1]*[x(2);x(3)]-3/5*[0 0;1 0]*[x(2);x(3)]*x(1)^-2/5-[0 0.1;0.1 0]*(s/norm(s))
u2=[1;0]*x(1)+[2 2.9;-0.1 -1]*[x(2);x(3)]
u=u1+u2
xdot=A*x+B*u
%and by using ode 45
clc; clear all close all;
tspan=[0 8]
x0=[0.15;-0.15;0.1]
[t,x]=ode45('func4',tspan,x0)
plot(t,x(:,1),t,x(:,2),t,x(:,3))
now it is not stopping, it runing from last hours continuously
please check the code and suggest what to do?

Best Answer

Capture45.JPG
sorry sir,
i tried the solution suggested by you but the result from your solution is not the same as required in this picture.Suggest me the solution to get the same result as in the picture.