Vous êtes sur la page 1sur 59

BACKSTEPPING TORQUE CONTROL FOR

CYLINDRICAL CAM IN SEQUENTIAL TYPE GEAR


SHIFT MECHANISM

By

PRIYANSHU AGARWAL
DECEMBER 2009

Department of Mechanical and Aerospace Engineering


State University of New York at Buffalo
Buffalo, New York 14260
Abstract
Faster and efficient gear shifts have always been the demand of automobile industry. Be

it an automatic transmission having distinctly low efficiency or an automated manual

transmission with combined benefits of automatic and manual gearboxes, the

phenomenon of gear shift has always been the area of interest. Sequential type gear shift

mechanisms have been increasingly employed in automated manual transmissions due to

their suitability to readily available (rotary) actuators. However, there is a dearth of

published literature addressing the issue of modeling the dynamics of the system and

developing a torque controller for such a gear shift mechanisms. The objective of this

work is to first model the dynamics of the mechanism and then to design a controller for

governing the torque applied on the cylindrical cam for the given mechanism parameters

and time varying reference input. Both the issues i.e. reducing shifting time and

improving efficiency of shifting can be addressed by the successful implementation of

such a torque controller.

i
Acknowledgement

I am highly thankful to Professor Tarunraj Singh for his support during the execution of

this work. Not only did he equip me with the technical skills required to deal with the

challenges involved in the problem, but his motivating examples of the work done by

some of the brilliant students from previous batches proved to be a constant source of

motivation for accomplishing this work.

Finally, I am also thankful to my colleagues in the course of Applied Nonlinear Control

who had technical discussions at times on the subject and always motivated me to explore

the unexplored.

ii
Contents
Abstract

Acknowledgement

Contents

List of Symbols

1 Introduction 
1.1 Motivation
1.2 Necessity of Torque Control
1.3 Problem Formulation
1.4 Challenges Involved
1.5 Report Organization

2 Background 
2.1 Mechanism description
2.1.1 Purpose
2.1.2 Construction
2.1.3 Working
2.2 Existing Controllers

3 Mathematical methods 
3.1 Mathematical Modeling
3.1.1 Fork Cantilever Beam Analogy
3.1.2 Drum Dynamics Equations
3.1.3 Fork Free Body Diagram
3.2 Governing Differential Equation and State-Space Representation
3.2.1 Governing Equation
3.2.2 System Analogy
3.2.3 Shift Force Behavior

4 Implementation 
4.1 Basic Controller
4.1.1 Backstepping Control Law Derivation
4.1.2 Standard Least Squares Estimator
4.2 Tracking Controller
4.2.1 Backstepping Control Law Derivation

iii
4.3 Actual Controller
4.3.1 Backstepping Control Law
4.3.2 Standard Least Squares Estimator
4.3.3 State Estimator (Integrator)
4.4 Model Linearization for Parameter Estimation
4.5 Standard Least Squares Estimator with Linearized Model

5 Results 
5.1 Basic Controller
5.1.1 Simulation with known Coefficient of Friction
5.1.2 Simulation with unknown Coefficient of Friction
5.2 Tracking Controller
5.2.1 Simulation with known Coefficient of Friction
5.2.2 Simulation with unknown Coefficient of Friction
5.3 Actual Controller
5.4 Virtual Reality Simulation

6 Discussion 

Bibliography

Appendix

A.1 MATLAB code for solving equations involved in the Mathematical Model of
the Dynamics of the Gearshift Mechanism
A.2 MATLAB code for Basic Controller with parameter estimation and
asymptotically stabilizing origin (Known Coefficient of Friction)
A.3 MATLAB code for Tracking Controller with parameter estimation and
reference output tracking (Known Coefficient of Friction)
A.4 MATLAB code for Final Controller with parameter and state estimation,
noise, reference output tracking and Virtual Reality Simulation. (Known
Coefficient of Friction)
A.5 MATLAB code for Basic Controller with parameter estimation using
linearized model for asymptotically stabilizing origin (Unknown Coefficient of
Friction)
A.6 MATLAB code for Tracking Controller with parameter estimation and
reference output tracking (Unknown Coefficient of Friction)

iv
Chapter 1

Introduction
The problem of control of a gearshift mechanism in an automated manual transmission is a challenging
problem. Apart from developing a mathematically accurate model of the mechanism, the biggest
challenge towards developing a perfect controller is the lack of repeatability in the process of gearshift
itself. Every time a gearshift is effected there are numerous parameters involved in deciding the exact
effort required for the gearshift mechanism to bring this change. There are parameters that are constant
and are inherently locked in the geometry of the components of the mechanism. And there are the ones
that vary with vehicle speed, gearshift mode, road load etc. And this becomes increasingly true for a
sequential type gearshift mechanism in an automated manual transmission where the lack of appropriate
control can lead to either quick wear of drive-train components such as clutch or synchronizers in case
of a synchromesh transmission.

1.1 Motivation
The direction, position and velocity of the fork during the shift can be governed by appropriate design and
control of the mechanism. What makes a mechanism proficient in gearshift is the ease with which it can
achieve the required dynamically varying force on the shift fork during gearshift. However, what makes
designing a controller for the mechanism difficult is the fact that the phenomenon of gearshift lasts for a
fraction of a second. This demands that the response time of the controller be extremely low. Thus, there
exist apparently irreconcilable requirements for the controller to achieve all these objectives. This calls for a
detailed study of the dynamics of the mechanism to make the system more amenable to control by
developing better controllers. The development of a controller in the context of sequential type mechanism
becomes more important due to the inherent suitability of the mechanism for automation due to readily
available rotary actuators.

Figure 1-1 Gearshift mechanism as a component of the drive-train


1
1.2 Necessity of Torque Control
The following are the reasons why torque control of a gearshift mechanism becomes an absolute
necessity:
1. It will help in faster, more efficient and smoother gear shifts.
2. There exists a dynamically varying force demand on Gearshift Forks.
3. The extremely low gear shift time demands very-high response.
4. There is also a variation of torque requirement between different gears.
5. The mechanism has variation of torque requirement within same gear with variation in driving
conditions (vehicle speed, gear shift mode etc.).

1.3 Problem Formulation


The objective is to design a controller for governing the torque applied on the cylindrical cam of a
sequential type gear shift mechanism in presence of parametric uncertainties for the following given
inputs:
• Mechanism Parameters (dimensions and friction coefficients)
• Reference signal (in the form of output or states of the system) as a function of time

The problem of designing a controller can be divided into two categories:


1. Controller to asymptotically stabilize the origin of the system states.
2. Controller for tracking a given feasible trajectory. This requires zero tracking error to be an
equilibrium.

The report deals with both the type of controllers along with means to handle parametric uncertainty in
the model dynamics. However, the report does not deals with the optimization of the controller gains
which is necessary to ensure performance.

Both the issues i.e. reducing shifting time and improving efficiency of shifting can be addressed by the
successful implementation of such a torque controller.

Estimator

Reference Gearshift Mechanism


Signal Controller Dynamics

Figure 1-2 Basic control block diagram

The system represented in Figure 1-2 illustrates the basic control block diagram of the system.

1.4 Challenges Involved


The following are the challenges involved in designing a controller for the gearshift mechanism:

1. Mathematical Modeling of the Dynamics of the Mechanism

2
A mathematical model need to be developed that can accurately represent the dynamics of the system.
The model will incorporate the effects of friction between various components. The presence of friction
makes the system highly nonlinear.

2. Model Parameter Uncertainties


The model involves parameters such as sleeve force spring and damping coefficients that are not known
beforehand and has to be estimated online. The presence of such uncertainties makes the controller and
estimator to run in tandem and still perform satisfactorily.

3. Controller Design
A controller that can handle the highly nonlinear system yet ensure successful tracking of reference
signal need to be developed. Also, in absence of a reference model some kind of a self-tuning technique
need to be employed for controlling the torque.

1.5 Report Organization


Chapter 1 deals with an introduction of the problem targeted in this work.

Chapter 2 deals with a basic overview of the mechanism.

Chapter 3 discusses the mathematical development involved in modeling the dynamics of the system.

Chapter 4 presents the various controllers developed for torque control.

Chapter 5 documents the results obtained by simulating the controllers developed.

Chapter 6 discusses the various results and concludes with the possible future work.

Appendix A contains a MATLAB code for the various controllers developed for the torque control of
the sequential type gearshift mechanism.

3
Chaptter 2
Backgground
d
This chapteer deals withh the basic description
d of the mechhanism disccussing its ppurpose, con
nstruction and
working. It then introdduces the reaader with thhe existing ccontroller foor such mecchanism.

2.1 Mechaanism desscription


This sectionn deals withh the basic overview
o off the mechannism.

2.1.1 Purpoose
The mechannism is a cyylindrical caam followeer system. T The basic puurpose of thhe mechanissm is to connvert
m into axiall force on tthe fork forr gearshift. The
given torquue input proovided to itt at the cyliindrical cam
mechanismm is used uniiversally in two-wheeleers and occaasionally inn four-wheellers for gearrshift.

(a) (b)
Figure 2-11 An illustraation of thee Sequentiall type Gear Shift Mech hanism (a) tthe manual version of the
t
mechanism m, (b) the automated
a v
version of th
he mechaniism

2.1.2 Consttruction
The mechannism shown in Figure 1((a) consists of o the follow
wing major components
c s:
• Drum1 (Cyylindrical Cam)
C
• Forks
• Fork Rail
• Star Wheeel
1
Please notee that the terrms drum annd the cylinddrical cam w
will be used interchangea
i ably through
h the text.

4
• Shift Lever-1 (Guitar shaped with a welded splined shaft)
• Shifter Lever-2 (Cross Lever)
• Torsion Spring
• Tension Spring

The drum, fork rail and splined shaft with shift lever-1 are supported in the casing. The shift lever-1 and shift
lever-2 are assembled along with the springs as shown in Figure 1 a). The star wheel is attached to the drum
with the help of a bolt and the drum is free to rotate about its axis. The drum is provided with grooves on its
circumference. Furthermore, the fork is provided with a lug that protrudes from its head. The lug on the fork
engages in the groove on the drum. The Fork legs rests on the gear collar (not shown in figure) and the fork
is constrained to move axially on the fork rail. In addition to this, the star wheel is provided with projected
lugs on its front face on which the shift lever-2 rests. Shift lever-2 is connected to shift lever-1 through a
revolute joint and tension spring between the two ensures that the shift lever-2 maintains contact with the star
wheel lugs. A torsion spring is provided on shift lever-1 to reposition the lever after shifting the gear to its
original position. The entire assembly is inside a transmission casing. Figure 1 b) shows the automated
version of the same mechanism. In this case the drum is rotated using a motor through gearing. The detent
lever is provided to keep the drum stationary on each engaged gear position.

2.1.3 Working
The shift lever-1 is rotated with the help of a push-pull type cable. As shift lever-1 rotates, it rotates shift
lever-2 which in turn rotates the star wheel. Since, the star wheel is rigidly connected with the drum, the
drum is also indexed by the same angle. The configuration of the two levers and star wheel is such that the
system is always indexed by a fixed angle for one stroke of the shift levers. Due to this fixed rotation of the
drum the forks engaged in the grooves on the drum surface move axially on the fork rail by a fixed distance.
This axial movement of the fork leads to the axial movement of the shifting sleeve which leads to shifting of
the corresponding gear. The fact to be noted here is that a single fork is manipulated by the mechanism
during a gearshift under load. The magnitude and pattern of required drum torque governs the gearshift feel
in the manual version. However, the main concern in the automated version is minimization of the peak
torque due to actuator size limitations.

2.2 Existing Controllers

Figure 2-2 Gearshift Mechanism used in Mercedes Smart Fortwo.


Though there are few products in the market that implement automated gearshift in the context of
synchromesh transmissions using sequential type gear shift mechanism. However, the reluctance of their
developers to disclose the details of the mechanism and its control has led to unavailability of published
literature that can be referred. Also, whether such controllers handle parametric uncertainty is not known.
5
Chapter 3

Mathematical Methods

This chapter deals with the development of the mathematical model for the dynamics of the gearshift
mechanism. Free body diagrams are developed for the various components in the mechanism and finally
a differential equation governing the dynamics of the system is obtained.

3.1 Mathematical Modeling


The objective of the mathematical model and the assumptions involved are as follows:

Objective: To develop a differential equation that can represent the dynamics of the mechanism. More
precisely, to develop a relationship that can relate the torque applied on the cylindrical cam with its
angular acceleration and the axial force resisting this motion applied on the fork.

Assumptions:
1. While gearshift both the fork legs make continuous contact with the gearshift sleeve. This ensures that
when the fork is loaded both the legs experience equal deformation in axial direction. This is indeed
critical for the gearshift sleeve, as differential loading might tilt the sleeve and can even increase the fork
required to shift it during a gearshift. This assumption neglects the influence of variation of tolerances
involved during manufacturing of components.
2. The fork lug is always in contact with the drum groove wall. This assumption signifies that the model
does not take into account any nonlinearity in terms of contact between the fork and the drum. So, any
unique position of the drum signifies unique position of the fork provided that the drum groove
geometry is known.
3. Drum bearings have no frictional losses. This ensures no frictional moment is acting to diminish the
applied torque on the drum.
4. All bodies are rigid. No deformation of the bodies involved in the system is considered.
5. Both the fork legs have same area moment of inertia. Though the moment of inertia of the fork legs
will differ and will also vary with the distance from the fork center line. In order to avoid complexities,
the influence of these parameters on force distribution among the two fork legs has been neglected.
6. The coefficient of friction is same for all contacts. Usually the coefficient of friction between the
components is that of standard lubricated steel to steel contact. However, at times the fork is fixed with
the rail in which case the fork rail slides in the transmission casing which is usually a pressure die-casted
aluminum component.

Figure 3-1 represents a simplified model of the mechanism to be used for developing the mathematical
model of the system. The torque TD is acting on the drum due to which drum experiences an angular
acceleration of which in turn accelerates the fork by . The gearshift sleeve also offers a force of Ffa1
and Ffa2 on the two fork legs which amounts to the total force acting on the fork axially.

6
Figure 3-1 Simplified representation of the mechanism with external forces & moments acting on it

3.1.1 Fork Cantilever Beam Analogy


According to this analogy the fork leg is considered to be a simple cantilever beam which bends in the
presence of an external load. Figure 3-2(a) represents the formula for the maximum deflection of a
cantilever beam. It can be easily seen that for a given deformation the load acting on the beam is
inversely proportional to the cube of the length of the beam.

As per the above mentioned analogy the two fork legs can be represented as two cantilever beams which
undergo same deflection under load. The condition of equal deflection comes from the assumption that
the two legs make continuous contact with the gearshift sleeve. So, the distribution of axial force on fork
legs is considered to be inversely proportional to the cube of their arm lengths from rail center line.
Hence, the fork acting on the fork can be distributed on the two legs accordingly.

(a)

7
(b) (c)

Figure 3-2 Gearshift ffork legs reepresented as two can


ntilever beaams. a) Form mula for maximum
m
o a cantileever beam, b) Forces acting
deflection of a on th
he two legss of gearshiift fork, and
d c) Simplified
representaation of fork
k legs as tw
wo cantileveer beams

Considering
g the aforem
mentioned analogy
a the force Ffa1 ccan be deducced to be ass follows:
3
F fa ( A2 2 + E2 2 ) 2
Ffa1 = 3 3

( A12 + E12 ) 2 + ( A22 + E22 ) 2


The dimenssions A1, A2, E1 and E2 can be refeerred in the Figures 3.5
5 and 3.6.

m Dynamicss Equation
3.1.2 Drum ns

Figure 3-3 Developed View of Drum


D Profille & Force Componentts acting on
n it

8
Figure 3-3 represents a developed view of the drum obtained by unwrapping the drum groove profile.
Also shown is a zoomed view of the fork lug and the forces acting on the drum due it.

Now, from Newton’s second law of motion

So, the net torque acting on the drum is given by

where, fl represents the friction force developed between the fork lug and the drum and is given by

Further in Figure 3-3 it can be seen in the zoomed view of the fork lug traversing the drum groove that
the drum groove ramp angle is related to the angular rotation of the drum and the axial movement of the
fork as given below

(A)

Also, the instantaneous axial velocity of the fork is related to the angular velocity of the drum by the
following equation

(B)

Differentiating the above equation we can obtain the following expression

(C)

Also, by integrating equation (A) we can get the following expression for x.

(D)

3.1.3 Fork Free Body Diagram

Figure 3-4 represents the free body diagram of the fork. The reaction of friction force fl and force R1as
was discussed in the previous section also acts on the fork lug. View U represents the top view of the
fork lug with these reactions acting on it. Now, in order to develop a better understanding of the system
in term so axial force and tangential force, these forces are distributed among the axial force FA,
tangential force FT and a moment Mf. The axial force FA tries to tilt the fork due to which normal
reactions Ny1 and Ny2 from the rail are developed in order to avoid tilting. The tangential force tries to
move the component in its direction. However, the almost symmetric location of the fork lug avoids
development of substantial moment in one direction due to which the two reactions Nx1 and Nx2 from the
rail are acting in the same direction. The reactions Nx1, Nx2, Ny1 and Ny2 thus lead to the friction forces
fx1, fx2, fy1 and fy2 respectively. The gearshift sleeve also applies force Fft on the fork leg as the force FT

9
Figure 3-4 Free-Body Diagram of Fork

also tries to rotate the fork about the rail center. Due to the force Fft a corresponding friction force also
acts on the fork leg which is developed between the fork and gearshift sleeve.

The tangential force, axial force and the moment as discussed above are given by the following
equations

The friction forces fx1, fx2, fy1 and fy2 are related to the corresponding normal reactions between the fork
and the rail by the following expressions

A coordinate system XFYFZF as represented in Figure 3-4 is also attached with the fork for conveniently
handling forces and moments acting on the fork. It is also to be noted that it is only in the axial direction
that the fork experiences acceleration, in all other directions the forces acting on the fork are in
equilibrium.
10
3.1.3.1 Equilibrium in XFYF Plane

Figure 3-5 Free-Body Diagram of Fork representing forces in XFYF plane.

Considering the forces acting on the fork in XF, YF direction and moment acting along ZF, we have

Since, the fork does not experience any acceleration (linear or angular) in these directions the net forces
and moments are equated to zero in the above equations.
11
3.1.3.2 Equilibrium in XFZF Plane

Figure 3-6 Free-Body Diagram of Fork representing forces in XFZF plane.

Considering the fork in XFZF plane, the fork experiences an acceleration in the ZF direction. So, the
equations are:

3.1.3.3 Equilibrium in YFZF Plane

As forces along XF, YF, ZF have already been taken care of, the only quantity left to be considered is
moment about XF axis.

Thus, the moment equation is given by

12
Figure 3-7 Free-Body Diagram of Fork representing forces in YFZF plane

3.2 Governing Differential Equation and State-Space Representation


Now, we have all the equations that capture the dynamics of the system. All we need is to solve them in
order to obtain the final expression for the drum angular acceleration.

3.2.1 Governing Equation

All the above mentioned equations i.e. Equation (1) – (13) & (A) – (F) are solved using Symbolic
Toolbox in MATLAB to obtain the following expression:

(14)

where, f1(θ), f2(θ) and f3(θ) are given by the following expressions

13
where,
ki s are consstants whichh depend on
n various meechanism paarameters an
nd which
h depends on
the drum grroove profille.

As can be seen, the sy ystem is hig


ghly non-lin
near with functions
f off state couppled with drrum torque and
axial force acting on th
he fork.

The actual expressionss obtained for


f the subsstituted valu
ues of the mechanism
m pparameters can be refeerred
in Appendix A.1

3.2.2 System Analogyy

Figure 3-88 Gearshift Mechanism


m analogy with a masss spring-daamper systtem

It can be eaasily seen frrom the systtem equatio ons that the gearshift
g meechanism ddynamics is analogous tot a
mass spring g-damper syystem havin ng time vary ying forces acting on th
he mass in oopposite directions and
da
damping co oefficient thhat varies ass a function of the displlacement off the mass.

3.2.3 Shift Force Behavior

A precise model
m for thhe shift force behavior will
w involvee mathemattical modeliing of the en ntire drive-ttrain
along with characterisstics of the clutch. This in itself iss another arrea of reseaarch. So, in
n order to av void
complexitiees the shift force is asssumed to behave
b as a combinatiion of a sprring with Ks as the sp pring

14
nd a damperr system wiith Bs as thee damping coefficient
constant an c a shown inn Figure 3-9
as 9. However,, the
value of Ks and Bs is assumed too be unkno own. The axxial force from
fr the forrk Ffa acts on
o the sleev
ve a
component of which compresses
c s the spring g and anoth
her component is dissippated due to t the dampping
behavior off the shift fo
orce.

or representation as a spring-dam
Figure 3--9 Shift forrce behavio mper system
m

So, mathem
matically thee axial forcee can be rep
presented ass follows:

Substituting
g the expresssion for thee axial forcee in the finaal equation (14),
( we gett the follow
wing equatio
on

(15)

Now, the State-Space representati


r ion of the sy
ystem is as follows:

15
Chapter 4

Implementation

This chapter deals with the different kinds of controllers developed in order to achieve the desired torque
control of the mechanism. It starts with the design of a basic controller that deals with asymptotically
stabilizing the state origin taking care of the parametric uncertainty in the model when full state
feedback is available. It then moves on to a tracking controller that deals with the tracking of the
reference signal and the parametric uncertainty under full state feedback. Further, it deals with a
controller with reference signal tracking, parametric uncertainty when one of the states and output is
available as feedback. Finally, it deals with linearization of the developed model for dealing with
unknown friction coefficient.

4.1 Basic Controller


The basic controller is developed with the following control objective and assumptions:

Control Objective: To design a control law to asymptotically stabilize the origin.

Assumptions:
1. Full state feedback is available.
2. Parameters Ks and Bs are unknown and constant.

Figure 4-1 Control block diagram of Basic Controller

Figure 4-1 illustrates the block diagram for the basic controller. The control law is derived using single-
integrator Backstepping. The controller provides input which is applied drum torque to the plant, the states
and the output of the plant is then measured and fed to the estimator. The estimator provides the estimated

16
values for the unknown parameters Ks and Bs. The estimated parameters and the states are provided to the
controller for evaluating the input for the next instant.

4.1.1 Backstepping Control Law Derivation


It can be seen from the state-space representation developed in the previous section that system is in
strict feedback form which is as follows:

Strict Feedback Form

So, the control law can be derived as follows:

where, u = TD is the torque input for the drum.

Since, the Lyapunov function is negative definite this ensures asymptotic convergence of the states to
zero.
17
4.1.2 Standard Least Squares Estimator

A standard least squares estimator is developed for parameter estimation with the following cost
function.

Cost Function

The following are various update laws used for parameter updation and gain matrix updation:

Parameter Update Law

So, for the present system it becomes

Gain Matrix Update Law

where,

4.2 Tracking Controller


The tracking controller has the capability of tracking a reference signal. It has the following control
objective and assumptions:

Control Objective: To design a control law to track the reference signal asymptotically.

Assumptions:
1. Full state feedback is available.
2. Parameters Ks and Bs are unknown and constant.
3. The reference signal is in the form of states of the system.

18
Figure 4-2 represents the control block diagram for the tracking controller. Here the controller works on
the new states z1 and z2 which are the difference of the actual states and the reference signal. The
estimation process is the same as defined for the previous controller.

Figure 4-2 Control block diagram of Tracking Controller

4.2.1 Backstepping Control Law Derivation


The control law is now derived for the states z1 and z2 is as follows:

19
where, u = TD

The negative definiteness of the Lyapunov function guarantees asymptotic convergence of the states to
the reference signal.

4.3 Actual Controller

Figure 4-3 Actual mechanism with plan for state, output measurement and state estimation
20
The actual controller is based on the fact that there will always be some noise in measurement.
Furthermore, in actual system a full state feedback can be avoided by measuring one of the states and
estimating the other one using the first one. Since, differentiating the signal to estimate a state leads to
noisy estimation, the technique of integration is used to estimate the angular position of the drum using
its angular velocity.

The control objective and assumptions of the controller are as follows:

Control Objective: To design a control law to track the reference signal asymptotically.

Assumptions:
1. Output y and State x2 is available as feedback.
2. Parameters Ks and Bs are unknown and constant.
3. There is noise present in measurement.

Figure 4-4 Control block diagram of Actual Controller

Figure 4-4 illustrates the control block diagram of the actual controller. The noise is introduced in the
measured signals. The integrator is used to estimate the state x1 using state x2. Also, the estimated signal is
now used in parameter estimation.

4.3.1 Backstepping Control Law

The control law for this controller remains same as derived for the previous controller with the following
modifications:

1. The measured value of x1 is now replaced with the estimated value obtained using an integrator.
2. High frequency noise is introduced in the measured states.

21
where, z1 and z2 includes the high frequency noise signal.

The negative definiteness of the Lyapunov function as derived in the control law derivation of the
tracking controller still holds good and so the states will converge to the reference signal asymptotically.

4.3.3 Standard Least Squares Estimator


The estimator for the actual system is the same with a modification that the estimated value of x1 is now
used in the estimator to estimate the parameters.

4.3.3 State Estimator (Integrator)


The state x1 is estimated by integrating the state x2 which also contains the noise signal. So, the
differential equation for estimator becomes

where, n2 represents the high frequency noise signal introduced in the state x2 during measurement.

4.4 Model Linearization for Parameter Estimation

The above developed parameter estimators are based on the assumption that the coefficient of friction
between the various components is precisely known. However, the coefficient of friction is not known
always. Since, the system is highly nonlinear the influence of coefficient of friction plays a vital role in
determining the behavior of the system. In actual vehicle there is always an uncertainty involved in
determining the value of coefficient of friction due to variation in lubrication. Even the viscosity of the
lubricant varies with temperature which in turn varies the coefficient between the interacting surfaces.
Thus, there is always a variation in the coefficient of friction which cannot be predicted, though the
range of variation might be narrow. Thus, this demands an estimation of the coefficient of friction by
using an estimator. However, considering the highly nonlinear dynamics of the system the estimation of
the coefficient of friction would be difficult.

The functions f1, f2 and f3 are functions of state and the coefficient of friction. Now, the Taylor series
expansion for a function about a point µ0 is given by

22
Now, neglecting higher order terms, we can obtain

where, f11(µ0) represents the value of the function at µ0 and f12 represents the value of the derivate of the
function with respect to µ at µ0.

Thus, each of the nonlinear function can be replaced by its linear approximation to give rise to the
following state-space representation of the system:

The unknown parameters in the model are then combined in such a manner that the reduced systems will
have unknowns that appear linearly. The value of functions f11, f12, f21, f22, f31 and f32 is mentioned in
Appendix A.1

4.5 Standard Least Squares Estimator with Linearized Model


A standard least squares estimator is then developed using this linearized model.

The parameter update law is given by

where,

The gain matrix update law is given by

where, P is a 5x5 gain matrix. Also, the input will now have the values of function f1, f2 and f3 evaluated
for the estimated value of the coefficient of friction.
23
Chaptter 5
Resultts
This chapteer documentts the resultts obtained for
f the diffeerent controollers discusssed in the previous
p
chapter. Thhe chapter presents firstt the results for the basic controlleer with knowwn coefficieent of frictio
on
and then the results wiith unknownn coefficiennt of frictionn i.e. with linearized moodel for parrameter
estimation. The resultss for the traccking controoller are theen providedd for the twoo cases. Finaally, the
chapter endds with the rresults for th
he actual coontroller whhich only deeals with thee known coeefficient of
friction case.

5.1 Basic Controller


The basic controller
c ass discussed in the previious chapterr is simulateed for the foollowing tw
wo cases:
1. Simulattion with knnown Coeffficient of Friiction – Thiis involves estimating
e pparameters Ks and Bs
2. Simulattion with unnknown Coeefficient off Friction – This
T involvves estimatinng parameteers a1, a2, a3, Ks
and Bs using
u the linnearized moodel.

5.1.1 Simulation with


h known Co oefficient off Friction
The results with knownn coefficiennt of frictionn are presennted in this section.
s

5.1.1.1 Sim
mulation Inp puts
The followiing inputs are
a used to simulate
s thee controller in MATLA
AB.

kθ = 0.5

γ(0) = 0.25 radian = 144.32o

0 =0

Ks = 20
Bs = 30
Ks (0) = 3
Bs (0) = 4
P (0) = [40 50]
[60 70]
7
K (backsteppping) = 1000000

224
Table 4-4 Mechanism Parameters used in Simulation
5.1.1.2 Simulation Results
Y vs t dY/dt vs t
15 0

-2

-4
10

dY/dt (deg/s) →
Y (deg)→

-6

-8

5
-10

-12

0 -14
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →
Ffa vs t
0.5

0.4

0.3

0.2
Ffa (kg) →

0.1

-0.1

-0.2

-0.3
0 1 2 3 4 5 6 7 8 9 10
time (s) →

25
W (Signal Matrix) vs t P (Gain Matrix) vs t
0.6 70
W1
W2 P11
0.4 60 P12
P21
P22
0.2 50

0 40
W→

P→
-0.2 30

-0.4 20

-0.6 10

-0.8 0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →
Ks vs t Bs vs t
20 30

18
25
16

14 20
Ks (kg/mm) →

Bs (kgs/m) →

12
15
10

8 10

6
5
4 Ksreal Bsreal
Kshat Bshat
2 0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →

Figure 5-1 Simulation results for basic controller with known coefficient of friction

The simulation results showed the following:


1. Both the states i.e. drum angular position and velocity, converge to zero asymptotically as is
expected.
2. Output i.e. the axial force developed on the fork also converges asymptotically to zero.
3. However, due to decay of states to zero the signal matrix of the parameter estimator is not
persistently exciting and it converges to zero in the course of time.
4. As a result of signal matrix converging to zero, the gain matrix for the estimator doesn’t converge to
zero, which is obvious from the following equation for gain updation.

5. The unknown parameters do not converge to their true value. However, they become constant after
certain time, which can be explained by the following equation for parameter updation.

26
As the signal matrix converged to zero the updation of parameters stop due to which they remain
constant.

5.1.2 Simulation with unknown Coefficient of Friction (Linearized model for Parameter
Estimation)
This section presents the result for the unknown coefficient of friction case.

5.1.2.1 Simulation Inputs


The following additional inputs (different values) are used for the simulation of this controller.

µreal = 0.14
µ (0) = 0.5
µ0 = 0.16
K (backstepping) = 1000

5.1.2.2 Simulation Results


Y vs t dY/dt vs t
15 0

-2

-4
10
dY/dt (deg/s) →
Y (deg)→

-6

-8

5
-10

-12

0 -14
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →
Ffa vs t
10

0
Ffa (kg) →

-5

-10

-15
0 1 2 3 4 5 6 7 8 9 10
time (s) →

27
W (Signal Matrix) vs t μ vs t
40 0.5
W1
35 W2 ureal
0.4
W3 uhat
30 W4
0.3
W5
25
0.2
20
W→

μ→
0.1
15
0
10

-0.1
5

0 -0.2

-5 -0.3
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →
Ks vs t Bs vs t
25 35
Ksreal
Kshat 30
20
25 Bsreal
Bshat
15 20
Ks (kg/mm) →

Bs (kgs/m) →

15
10
10

5 5

0
0
-5

-5 -10
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →
Figure 5-2 Simulation results for basic controller with unknown coefficient of friction

The simulation results showed the following:


1. Both the states i.e. drum angular position and velocity; converge to zero asymptotically in almost the
same time as was for the known coefficient of friction case.
2. Output i.e. the axial force developed on the fork also converges asymptotically to zero in almost the
same time.
3. However, there is appreciable difference in the signal matrix of the estimator between the two cases.
The signal matrix converged to zero in the unknown coefficient of friction case much rapidly.
4. In this case the estimation of the coefficient of friction also takes place. There is considerable error
in the estimated value of the coefficient. However, the error became constant in the course of time.
This error in estimation can be attributed to the fact that the signal matrix decayed to zero rapidly in
this case.
5. The unknown parameters also become constant after certain time, which can be explained by the
following equation for parameter updation.

28
However, the steady-state error in estimation is more in this case then the known coefficient case.

5.2 Tracking Controller


The tracking controller as discussed in the previous chapter is also simulated for the two cases discussed
in the previous section.

5.2.1 Simulation with known Coefficient of Friction


This section presents the results of the tracking controller for the known coefficient of friction case.

5.2.1.1 Simulation Inputs

xr = sin(t)

5.2.1.2 Simulation Results

Y vs t dY/dt vs t
80 60
Yr
Yrdot
Y
60 Ydot
40

40
20
dY/dt (deg/s) →
Y (deg)→

20
0
0

-20
-20

-40
-40

-60 -60
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →

29
Ffa vs t
45

40 Ffar
Ffa
35

30

25
Ffa (kg) →

20

15

10

-5
0 1 2 3 4 5 6 7 8 9 10
time (s) →

P(Gain Matrix) vs t W (Signal Matrix) vs t


0.04 10
P11 W1
0.035 P12 8 W2
P21
0.03 P22 6

0.025 4

0.02 2
W→
P→

0.015 0

0.01 -2

0.005 -4

0 -6

-0.005 -8
0 10 20 30 40 50 60 70 80 90 100 0 5 10 15 20 25
time (s) → time (s) →

Bs vs t Ks vs t
5
0.7

Bsreal 4.9
0.6 Bshat
4.8

0.5 4.7
Ks (kg/mm) →

4.6
Bs (kgs/m) →

0.4
4.5

0.3 4.4

4.3
0.2

4.2
0.1
4.1 Ksreal
Kshat
0 4
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
time (s) → time (s) →

30
Figure 5-3 Simulation results for tracking controller with known coefficient of friction

The simulation results showed the following:


1. Both the states i.e. drum angular position and velocity, tracks the reference signal asymptotically.
2. Output i.e. the axial force developed on the fork which is combination of the two states and the
unknown parameters also tracks the reference signal asymptotically.
3. The signal matrix of the estimator is persistently exciting in this case.
4. Due to persistently exciting signal matrix, the gain matrix for the estimator converges to zero.
5. The unknown parameters also converge to their true value asymptotically.

5.2.2 Simulation with unknown Coefficient of Friction (Linearized model for Parameter
Estimation)
The simulation results for the unknown coefficient of friction are presented in this section.

5.1.2.1 Simulation Inputs


The following additional inputs (different values) are used for the simulation of this controller.
µreal = 0.14
µ (0) = 0.4
µ0 = 0.16
K(backstepping) = 10;
P0 = [0.001:0.001:0.025];
Y vs t dY/dt vs t
60 60

Yrdot
Ydot
40 40

20 20
dY/dt (deg/s) →
Y (deg)→

0 0

-20 -20

-40 -40
Yr
Y
-60 -60
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →

31
Ffa vs t
35
Ffar
30 Ffa

25

20
Ffa (kg) →

15

10

-5
0 1 2 3 4 5 6 7 8 9 10
time (s) →
W (Signal Matrix) vs t μ vs t
6 0.45
W1
ureal
W2
5 0.4 uhat
W3
W4
4 W5 0.35

3 0.3
W→

μ→

2 0.25

1 0.2

0 0.15

-1 0.1
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →
Ks vs t Bs vs t
0.2
5
0.1
Ksreal
4.8 Kshat
0 Bsreal
Bshat
Ks (kg/mm) →

4.6 -0.1
Bs (kgs/m) →

-0.2
4.4

-0.3
4.2
-0.4

4
-0.5

3.8 -0.6
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →

Figure 5-4 Simulation results for tracking controller with unknown coefficient of friction
32
The simulation results showed the following:
1. The controller had hard time tracking both the states i.e. drum angular position and velocity.
2. The output i.e. the axial force developed on the fork also shows large variations between the actual
and the reference signal.
3. The signal matrix of the estimator remains persistently exciting in this case.
4. Even when the signal matrix is persistently exciting the coefficient of friction do not converge to its
true value.
5. The unknown parameters also do not converge to their respective true values.

5.3 Actual Controller


The actual controller discussed in the previous chapter is simulated in the following section. Due to the
inability of the tracking controller to track the reference signal for the unknown coefficient of friction
case, it becomes pointless to simulate the same for the actual controller which includes noise and state
estimation. The following section presents the result with only the known coefficient of friction.

5.3.1 Simulation Inputs


Apart from the simulation inputs of the tracking controller with known coefficient of friction, the
following inputs are used for the simulation.

Noise (x2)
n2 = 0.2sin(20*t)
Noise (y)
ny = sin(20*t)

The noise signal is modeled as a high frequency periodic disturbance from a rotating source which might
be the engine or the rotating driveline with huge inertia.

5.3.2 Simulation Resutls


The simulation results showed the following:
Y vs t dY/dt vs t
80 80

60 60

40
40
dY/dt (deg/s) →

20
Y (deg)→

20

0
0
-20

-20
-40
Yrdot
Yr
-40 Ydot
Y -60
Ydot measured
Yhat
-60 -80
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
time (s) → time (s) →

33
Ffa vs t
45
Ffar
40 Ffa
Ffa measured
35

30

25
Ffa (kg) →

20

15

10

-5
0 1 2 3 4 5 6 7 8 9 10
time (s) →

W (Signal Matrix) vs t P(Gain Matrix) vs t


10 0.04
W1 P11
8 W2 0.035 P12
P21
6
0.03 P22
4
0.025
2
0.02
W→

P→

0
0.015
-2
0.01
-4

-6 0.005

-8 0

-10 -0.005
0 5 10 15 20 25 0 10 20 30 40 50 60 70 80 90 100
time (s) → time (s) →

Ks vs t Bs vs t
5 0.7

Bsreal
4.9
0.6 Bshat
4.8

0.5
4.7
Ks (kg/mm) →

Bs (kgs/m) →

4.6
0.4

4.5
0.3
4.4

4.3 0.2

4.2
0.1
4.1 Ksreal
Kshat
4 0
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
time (s) → time (s) →

Figure 5-5 Simulation results for actual controller with known coefficient of friction
34
1. The estimated drum angular position tracks the actual position and in due course of time both of
them track the reference signal.
2. The measured state follows the actual state though with lesser deviations, however there are slight
deviations of the two from the reference signal due to high frequency noise present in the
measurement. Such deviations can be dealt with by appropriate filtering of the measured state.
3. Output i.e. the axial force developed on the fork also tracks the reference signal asymptotically with
small deviations present due to noise in the measured signal.
4. The signal matrix of the parameter estimator is persistently exciting in this case.
5. Due to persistently exciting signal matrix, the gain matrix for the estimator converges to zero
asymptotically.
6. The unknown parameters also converge to their true value asymptotically.

5.4 Virtual Reality Simulation


In order to understand the physical behavior of the system a simulation is developed in MATLAB using
Virtual Reality Toolbox for the results obtained for the actual controller. The variation in angular
velocity was appreciable in the simulation of the 3d-model.

35
Chapter 6
Discussion

The basic controller with known coefficient of friction worked satisfactorily for asymptotically
converging states to zero. The basic controller with unknown coefficient of friction worked as good as
the one with known value. The tracking controller worked satisfactorily for the known coefficient of
friction case. However, the tracking controller with unknown coefficient of friction was unable to track
the reference signal. The actual controller worked well for the known coefficient for friction case.

The results showed that the unknown coefficient of friction case is difficult to handle with, in real world.
When it comes to determining the asymptotic stability using a controller the parameter estimator with a
linearized model worked as good as a known parameter case, with states decaying to zero in almost the
same time for the two cases. However, the parameter estimation failed to track the reference signal with
the linearized model against the perfect tracking achieved by the known parameter case controller. The
results also showed that the standard least squares estimator is immune to noise in the signal matrix.

Thus, a first order linearization of the system for parameter estimation is not sufficient for a gearshift
mechanism which is a highly nonlinear system to not only estimate the unknown parameters accurately
but also for reference signal tracking.

The future work for dealing with the problem of control of a gearshift mechanism might involve
improving the model that has been developed and to improve the controller. The model can be modified
to take into account the nonlinearity in the model due to deformation of the fork. Also, the variation in
area moment of inertia of the two legs of the fork can be taken into account for more realistic
distribution of forces. The controller for the unknown coefficient of friction case can be developed
considering the second order approximation of the nonlinear functions involved. However, it will lead to
more number of unknown parameters in the model to be estimated which need to be dealt with
accordingly.

36
Bibliography

[1] Chaouch S., Nait-Sait M (2006), Backstepping control design for position and speed tracking
of DC motors.

[2] Aneke N. P. I., Nijmeijerz H. and Jager A. G. (2003), Tracking control of second-order
chained form systems by cascaded backstepping, International journal of robust and nonlinear
control.

[3] Xie Chengkang, (2004), Nonlinear Output Feedback Control: An Analysis of Performance and
Robustness, Phd thesis, UNIVERSITY OF SOUTHAMPTON.

[4] Faa J L, Rong J W (2001), A Hybrid Computed Torque Controller Using Fuzzy Neural Network for
Motor-Quick-Return Servo Mechanism, IEEE/ASME TRANSACTIONS ON MECHATRONICS,
VOL. 6, NO. 1, MARCH 2001

[5] Yang Z; Wu J; Mei J; Gao J and Huang T (2008), Mechatronic Model Based Computed Torque
Control of a Parallel Manipulator, International Journal of Advanced Robotic Systems, Vol. 5, No. 1
ISSN 1729-8806, pp.123-128.

[6] Yang Z; Wu J; Mei J (2007), Motor-mechanism dynamic model based neural network optimized
computed torque control of a high speed parallel manipulator, Mechatronics 17 (2007) 381–390.

[7] Weiwei S., Shuang C (2009), Nonlinear computed torque control for a high-speed planar parallel
manipulator, Mechatronics 19 (2009) 987–992.

[8] Rothbart H. A., Cam design handbook, McGraw-Hill Handbooks, 2004, pp. 27-55.

[9] Norton R. L., Cam design and manufacturing handbook, Industrial Press, Inc., pp. 177-312.

37
Appendix A
A.1 MATLAB code for solving equations involved in the Mathematical Model of the
Dynamics of the Gearshift Mechanism
clc;
clear all;
close all;

syms R1 FA FT Fft_f Nx1 Nx2 Ny1 Ny2 Ffa TD theta RD u ID mf zeta_ang C A2 A1 B1 B2


E1 E2 O1 O2 O3 d dl phi gammadot gammadot2 K1 K2 dthetadgamma Dsi;

Eqn = 'FA -R1*(cos(theta)-u*sin(theta)) ,


FT -R1*(sin(theta)+u*cos(theta)),
FT+Fft_f*cos(zeta_ang)-Nx1-Nx2,FT*sin(phi)+Ny1-Ny2-Fft_f*sin(zeta_ang),
-FT*C+Fft_f*A2/cos(zeta_ang),
FA*C*sin(phi)+Ffa*((A2^2+E2^2)^(3/2)/((A1^2+E1^2)^(3/2) +(A2^2+E2^2)^(3/2))*E1-(1-
(A2^2+E2^2)^(3/2)/((A1^2+E1^2)^(3/2)+ (A2^2+E2^2)^(3/2)))*E2)+
Fft_f*cos(zeta_ang)*O3+Nx2*O2-Nx1*O1+u*(Nx1+Nx2)*d/2+u*R1*dl/2*cos(phi)-
u*Fft_f*Dsi*cos(zeta_ang),
-FA*C*cos(phi)-FT*sin(phi)*O3-Ffa*((A2^2+E2^2)^(3/2)/((A1^2+E1^2)^(3/2)+
(A2^2+E2^2)^(3/2))*A1-(1-(A2^2+E2^2)^(3/2)/((A1^2+E1^2)^(3/2)+
(A2^2+E2^2)^(3/2)))*A2)+Ny1*B1+Ny2*B2-u*Ny1*d/2+u*Ny2*d/2+u*R1*dl*sin(phi)/2-
u*Fft_f*((A1+A2)/2-Dsi*sin(zeta_ang)),
FA-u*(Ny1+Ny2+Nx1+Nx2)-Ffa-u*Fft_f-mf*RD*(tan(theta)*gammadot2+
sec(theta)^2*dthetadgamma*gammadot^2),
TD -R1*(sin(theta)+u*cos(theta))*RD-ID*gammadot2';

S = solve(Eqn,FA,FT,Fft_f,Nx1,Nx2,Ny1,Ny2,R1,gammadot2)

gammadot2_val = S.gammadot2
fun_sim = vpa(simplify(subs(simplify(gammadot2_val),{dl,RD, zeta_ang, C,A2, A1, B1,
B2, E1, E2, O1, O2, O3, d, phi, ID, mf, Dsi} ,{8.3, 24.5, 31.61*pi/180, 14.95,
45.35, 87.09, 17.64, 84.35, 33.91,33.91, 85.44, 16.55, 67.8, 13, 62.08*pi/180, 200,
0.2, 74.63})))
f1 = vpa(simplify(subs(fun_sim,{TD, Ffa, gammadot,u} ,{1,0,0,0.16})),4)
f2 = vpa(simplify(subs(fun_sim,{TD, Ffa, gammadot,u} ,{0,1,0,0.16})),4)
f3 = vpa(simplify(subs(fun_sim,{TD, Ffa, gammadot,u} ,{0,0,1,0.16})),4)
-----------------------------------------------------------------------------------
The expressions obtained for f1, f2 and f3
f1 = .3906e-2*cos(theta)*(-.2294e21*cos(theta)-.4584e18+.1275e21*sin(theta))/
(.8091e20*sin(theta)*cos(theta)-.6243e20*cos(theta)^2-.3581e18*cos(theta)-.1168e21)

f2 =
.8896e18*cos(theta)*(4.*cos(theta)+25.*sin(theta))/(.8091e20*sin(theta)*cos(theta)-
.6243e20*cos(theta)^2-.3581e18*cos(theta)-.1168e21)

f3 = .4671e19*dthetadgamma*(4.*cos(theta)+25.*sin(theta))/cos(theta)/
(.8091e20*sin(theta)*cos(theta)-.6243e20*cos(theta)^2-.3581e18*cos(theta)-.1168e21)
-----------------------------------------------------------------------------------------------------------
The expressions obtained for f11, f12, f21, f22, f31 and f32.

f11 =.1562e-1*cos(theta).*(.2293e9*cos(theta)+.4584e6-
.1275e9*sin(theta))./(.2497e9*cos(theta).^2+.4670e9+.1432e7*cos(theta)-
.3236e9*sin(theta).*cos(theta))

-1-
f12 =-4.882*cos(theta).*(.3153e15*cos(theta).^3-.3155e15*cos(theta)-
.8563e13*cos(theta).^2+.7925e15*sin(theta).*cos(theta).^2+.8563e13+.6851e12*sin(the
ta).*cos(theta)-.1186e16*sin(theta))./(.4239e17*cos(theta).^4-
.3379e18*cos(theta).^2-.7153e15*cos(theta).^3+.1616e18*cos(theta).^3.*sin(theta)-
.2181e18-
.1338e16*cos(theta)+.3023e18*sin(theta).*cos(theta)+.9271e15*sin(theta).*cos(theta)
.^2)

f21 =-
.3558e7*cos(theta).*(4.*cos(theta)+25.*sin(theta))./(.2497e9*cos(theta).^2+.4670e9+
.1432e7*cos(theta)-.3236e9*sin(theta).*cos(theta))

f22 =-500.*cos(theta).*(.3237e15*cos(theta).^3-
.4609e15*cos(theta)+.2731e12*cos(theta).^2-
.1016e15*sin(theta).*cos(theta).^2+.3711e14*sin(theta)+.3299e13*sin(theta).*cos(the
ta))./(.4239e17*cos(theta).^4-.3379e18*cos(theta).^2-
.7153e15*cos(theta).^3+.1616e18*cos(theta).^3.*sin(theta)-.2181e18-
.1338e16*cos(theta)+.3023e18*sin(theta).*cos(theta)+.9271e15*sin(theta).*cos(theta)
.^2)

f31 =-
.1868e8*dtdg*(4.*cos(theta)+25.*sin(theta))./cos(theta)./(.2497e9*cos(theta).^2+.46
70e9+.1432e7*cos(theta)-.3236e9*sin(theta).*cos(theta));

f32 =-.4670e9*dtdg*(.1657e10*cos(theta).^2-.2479e10+.1432e7*cos(theta)-
.6595e9*sin(theta).*cos(theta)+.1790e8*sin(theta))./(.4239e17*cos(theta).^4-
.3379e18*cos(theta).^2-.7153e15*cos(theta).^3+.1616e18*cos(theta).^3.*sin(theta)-
.2181e18-
.1338e16*cos(theta)+.3023e18*sin(theta).*cos(theta)+.9271e15*sin(theta).*cos(theta)
.^2)

A.2 MATLAB code for Basic Controller with parameter estimation and
asymptotically stabilizing origin (Known Coefficient of Friction)
function Basic_Controller
clc;
clear all;
global Ksreal Bsreal ktheta RD
ktheta = 0.5;
RD = 24.5;
sgn =1;
Ksreal = 20;
Bsreal = 30;
Kshat0 = 3;
Bshat0 = 4;
P0 = [40 50;
60 70];
y0 = [0.25 0 Kshat0 Bshat0 P0(1,1) P0(1,2) P0(2,1) P0(2,2)]; %gamma gammadot Kshat
Bshat P(1,1) P(1,2) P(2,1) P(2,2)

[T Y] = ode45(@mysystem,linspace(0,5),y0); %gamma gammadot Kshat Bshat P(1,1)


P(1,2) P(2,1) P(2,2)
figure;
plot(T,Y(:,1)*180/pi,'-');
grid on
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Y (deg)\rightarrow','FontSize',12);
title('Y vs t','FontSize',15);

-2-
figure
plot(T,Y(:,2)*180/pi,'-r');
grid on
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('dY/dt (deg/s) \rightarrow','FontSize',12);
title('dY/dt vs t','FontSize',15);
figure
plot(T,2*Y(:,1)+3*Y(:,2),'-r');
grid on
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ffa (kg) \rightarrow','FontSize',12);
title('Ffa vs t','FontSize',15);
figure
p = plot(T,Ksreal*ones(size(T)),'-b',T,Y(:,3),'-r');
grid on
legend(p,'Ksreal','Kshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ks (kg/mm) \rightarrow','FontSize',12);
title('Ks vs t','FontSize',15);
figure
p = plot(T,Bsreal*ones(size(T)),'-b',T,Y(:,4),'-r');
grid on
legend(p,'Bsreal','Bshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Bs (kgs/m) \rightarrow','FontSize',12);
title('Bs vs t','FontSize',15);
figure
p = plot(T,Y(:,5),'-b',T,Y(:,6),'-r',T,Y(:,7),'-y',T,Y(:,8),'-k');
grid on
legend(p,'P11','P12','P21','P22',1);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('P \rightarrow','FontSize',12);
title('P(Gain Matrix) vs t','FontSize',15);
figure
p = plot(T,RD*ktheta*Y(:,1).*Y(:,1)/2 ,'-b',T,RD*tan(ktheta*Y(:,1)).*Y(:,2),'-r');
grid on
legend(p,'W1','W2',1);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('W \rightarrow','FontSize',12);
title('W (Signal Matrix) vs t','FontSize',15);
clear all;
function dy = mysystem(t,y)
global Ksreal Bsreal ktheta RD
K_bs = 100000;
dy = zeros(8,1);
dtdg = ktheta;
theta_val = ktheta*y(1);
f1_val = .3906e-2*cos(theta_val)*(-
.1275e21*sin(theta_val)+.2294e21*cos(theta_val)+.4584e18)/(.6243e20*cos(theta_val)^
2+.3581e18*cos(theta_val)-.8091e20*sin(theta_val)*cos(theta_val)+.1168e21);
f2_val =-
.8896e18*cos(theta_val)*(25.*sin(theta_val)+4.*cos(theta_val))/(.6243e20*cos(theta_
val)^2+.3581e18*cos(theta_val)-.8091e20*sin(theta_val)*cos(theta_val)+.1168e21);
f3_val =.4671e19*dtdg*(25.*sin(theta_val)+4.*cos(theta_val))/cos(theta_val)/(-
.6243e20*cos(theta_val)^2-
.3581e18*cos(theta_val)+.8091e20*sin(theta_val)*cos(theta_val)-.1168e21);
Kshat = y(3);
Bshat = y(4);
W = [RD*log(sec(theta_val))/(ktheta) RD*tan(theta_val)*y(2)];
-3-
P = [y(5) y(6);
y(7) y(8)];
u = (-y(2)-y(1)-K_bs*(y(1)+y(2))-f2_val*Kshat*RD*log(sec(theta_val))/(ktheta)-
(f2_val*Bshat*RD*tan(theta_val)+f3_val)*y(2))/f1_val;
dy(1) = y(2); %gamma gammadot Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)
dy(2) =
f1_val*u+f2_val*(Ksreal*RD*log(sec(theta_val))/(ktheta)+Bsreal*RD*tan(theta_val)*y(
2))+f3_val*y(2);
dy(3) = -
(P(1,1)*RD*log(sec(theta_val))/(ktheta)+P(1,2)*RD*tan(theta_val)*y(2))*(W*[Kshat
Bshat]'-(Ksreal*W(1)+Bsreal*W(2)));
dy(4) = -
(P(2,1)*RD*log(sec(theta_val))/(ktheta)+P(2,2)*RD*tan(theta_val)*y(2))*(W*[Kshat
Bshat]'-(Ksreal*W(1)+Bsreal*W(2)));
dy(5) = -(P(1,1)*W(1)+P(1,2)*W(2))*(W(1)*P(1,1)+W(2)*P(2,1));
dy(6) = -(P(1,1)*W(1)+P(1,2)*W(2))*(W(1)*P(1,2)+W(2)*P(2,2));
dy(7) = -(P(2,1)*W(1)+P(2,2)*W(2))*(W(1)*P(1,1)+W(2)*P(2,1));
dy(8) = -(P(2,1)*W(1)+P(2,2)*W(2))*(W(1)*P(1,2)+W(2)*P(2,2));

A.3 MATLAB code for Tracking Controller with parameter estimation and
reference output tracking (Known Coefficient of Friction)
function Tracking_Controller
clc;
clear all;
close all;
global Ksreal Bsreal ktheta RD
ktheta = 0.5;
RD = 24.5;
sgn =1;
Ksreal = 5;
Bsreal = 0.1;
Kshat0 = 4;
Bshat0 = 0.01;
P0 = [0.02 0.01;
0.03 0.04];
ref = @(T) sin(T);
refdot = @(T) cos(T);
y0 = [0.5 -0.5 Kshat0 Bshat0 P0(1,1) P0(1,2) P0(2,1) P0(2,2)]; %z(gamma-gammaref)
zdot(gammadot-gammadotref) Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)
[T Y] = ode45(@mysystem,[0,10],y0); %z(gamma-gammaref) zdot(gammadot-gammadotref)
Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)
figure;
p = plot(T,ref(T)*180/pi,'-b',T,(Y(:,1)+ref(T))*180/pi,'-r');
grid on
legend(p,'Yr','Y',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Y (deg)\rightarrow','FontSize',12);
title('Y vs t','FontSize',15);

figure
p = plot(T,refdot(T)*180/pi,'-b',T,(Y(:,2)+refdot(T))*180/pi,'-r');
grid on
legend(p,'Yrdot','Ydot',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('dY/dt (deg/s) \rightarrow','FontSize',12);
title('dY/dt vs t','FontSize',15);
figure

-4-
p =
plot(T,Ksreal*RD*log(sec(ktheta*(ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(ref(T))).*r
efdot(T),...
'-
b',T,Ksreal*RD*log(sec(ktheta*(Y(:,1)+ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(ref(T)
)).*Y(:,2),'-r');
grid on
legend(p,'Ffar','Ffa',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ffa (kg) \rightarrow','FontSize',12);
title('Ffa vs t','FontSize',15);
figure
p = plot(T,Ksreal*ones(size(T)),'-b',T,Y(:,3),'-r');
grid on
legend(p,'Ksreal','Kshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ks (kg/mm) \rightarrow','FontSize',12);
title('Ks vs t','FontSize',15);
figure
p = plot(T,Bsreal*ones(size(T)),'-b',T,Y(:,4),'-r');
grid on
legend(p,'Bsreal','Bshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Bs (kgs/m) \rightarrow','FontSize',12);
title('Bs vs t','FontSize',15);
figure
p = plot(T,Y(:,5),'-b',T,Y(:,6),'-r',T,Y(:,7),'-y',T,Y(:,8),'-k');
grid on
legend(p,'P11','P12','P21','P22',1);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('P \rightarrow','FontSize',12);
title('P(Gain Matrix) vs t','FontSize',15);
figure
p = plot(T,RD*(log(sec(ktheta*(Y(:,1)+ref(T)))))/(ktheta) ,'-
b',T,RD*tan(ktheta*(Y(:,1)+ref(T))).*(Y(:,2)+refdot(T)),'-r');
grid on
legend(p,'W1','W2',1);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('W \rightarrow','FontSize',12);
title('W (Signal Matrix) vs t','FontSize',15);
clear all;

function dy = mysystem(t,y)
global Ksreal Bsreal ktheta RD
K_bs = 100;
dy = zeros(8,1);
xr = sint(t);
xrdot = cos(t);
xrdot2 = -sin(t);
dtdg = ktheta;
theta_val = ktheta*(y(1)+sin(t));
f1_val = .3906e-2*cos(theta_val)*(-
.1275e21*sin(theta_val)+.2294e21*cos(theta_val)+.4584e18)/(.6243e20*cos(theta_val)^
2+.3581e18*cos(theta_val)-.8091e20*sin(theta_val)*cos(theta_val)+.1168e21);
f2_val =-
.8896e18*cos(theta_val)*(25.*sin(theta_val)+4.*cos(theta_val))/(.6243e20*cos(theta_
val)^2+.3581e18*cos(theta_val)-.8091e20*sin(theta_val)*cos(theta_val)+.1168e21);

-5-
f3_val =.4671e19*dtdg*(25.*sin(theta_val)+4.*cos(theta_val))/cos(theta_val)/(-
.6243e20*cos(theta_val)^2-
.3581e18*cos(theta_val)+.8091e20*sin(theta_val)*cos(theta_val)-.1168e21);
Kshat = y(3);
Bshat = y(4);
W = [RD*log(sec(theta_val))/(ktheta) RD*tan(theta_val)*(y(2)+xrdot)];
P = [y(5) y(6);
y(7) y(8)];
u = (-y(2)-y(1)-K_bs*(y(1)+y(2))-f2_val*Kshat*RD*log(sec(theta_val))/ktheta -
(f2_val*Bshat*RD*tan(theta_val)+f3_val)*(y(2)+xrdot)-xrdot2)/f1_val;
dy(1) = y(2); %z(gamma-gammaref) zdot(gammadot-gammadotref) Kshat Bshat P(1,1)
P(1,2) P(2,1) P(2,2)
dy(2) = f1_val*u+f2_val*Ksreal*RD*log(sec(theta_val))/ktheta +
(f2_val*Bsreal*RD*tan(theta_val)+f3_val)*(y(2)+xrdot)-xrdot2;
dy(3) = -
(P(1,1)*RD*log(sec(theta_val))/(ktheta)+P(1,2)*RD*tan(theta_val)*(y(2)+xrdot))*(W*[
Kshat Bshat]'-(Ksreal*W(1)+Bsreal*W(2)));
dy(4) = -
(P(2,1)*RD*log(sec(theta_val))/(ktheta)+P(2,2)*RD*tan(theta_val)*(y(2)+xrdot))*(W*[
Kshat Bshat]'-(Ksreal*W(1)+Bsreal*W(2)));
dy(5) = -(P(1,1)*W(1)+P(1,2)*W(2))*(W(1)*P(1,1)+W(2)*P(2,1));
dy(6) = -(P(1,1)*W(1)+P(1,2)*W(2))*(W(1)*P(1,2)+W(2)*P(2,2));
dy(7) = -(P(2,1)*W(1)+P(2,2)*W(2))*(W(1)*P(1,1)+W(2)*P(2,1));
dy(8) = -(P(2,1)*W(1)+P(2,2)*W(2))*(W(1)*P(1,2)+W(2)*P(2,2));

A.4 MATLAB code for Final Controller with parameter and state estimation, noise,
reference output tracking and Virtual Reality Simulation. (Known Coefficient of
Friction)
function Actual_Backstepping_Controller
clc;
clear all;
close all;
global Ksreal Bsreal ktheta RD
ktheta = 0.5;
RD = 24.5;
sgn =1;
Ksreal = 5;
Bsreal = 0.1;
Kshat0 = 4;
Bshat0 = 0.01;
P0 = [0.02 0.01;
0.03 0.04];
ref = @(T) sin(T);
refdot = @(T) cos(T);
n2 = @(T) 0.2*sin(20*T);
ny = @(T) sin(20*T);
y0 = [0.5 -0.5 Kshat0 Bshat0 P0(1,1) P0(1,2) P0(2,1) P0(2,2) 0.5]; %z(gamma-
gammaref) zdot(gammadot-gammadotref) Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)
[T Y] = ode45(@mysystem,[0,10],y0); %z(gamma-gammaref) zdot(gammadot-gammadotref)
Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)

figure;
p = plot(T,ref(T)*180/pi,'-b',T,(Y(:,1)+ref(T))*180/pi,'-
.r',T,(Y(:,9)+ref(T))*180/pi,'--k');
grid on
legend(p,'Yr','Y','Yhat',4);
xlabel('time (s) \rightarrow','FontSize',12);
-6-
ylabel('Y (deg)\rightarrow','FontSize',12);
title('Y vs t','FontSize',15);
figure
p = plot(T,refdot(T)*180/pi,'-b',T,(Y(:,2)+refdot(T))*180/pi,'--
r',T,(Y(:,2)+refdot(T)+n2(T))*180/pi,':k');
grid on
legend(p,'Yrdot','Ydot','Ydot measured',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('dY/dt (deg/s) \rightarrow','FontSize',12);
title('dY/dt vs t','FontSize',15);
figure
p =
plot(T,Ksreal*RD*log(sec(ktheta*(ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(ref(T))).*r
efdot(T),...
'-
b',T,Ksreal*RD*log(sec(ktheta*(Y(:,1)+ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(ref(T)
)).*(Y(:,2)+refdot(T)),'--r',...

T,Ksreal*RD*log(sec(ktheta*(Y(:,1)+ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(ref(T))).
*(Y(:,2)+refdot(T))+ny(T),':k');
grid on
legend(p,'Ffar','Ffa','Ffa measured',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ffa (kg) \rightarrow','FontSize',12);
title('Ffa vs t','FontSize',15);
figure
p = plot(T,Ksreal*ones(size(T)),'-b',T,Y(:,3),'--r');
grid on
legend(p,'Ksreal','Kshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ks (kg/mm) \rightarrow','FontSize',12);
title('Ks vs t','FontSize',15);
figure
p = plot(T,Bsreal*ones(size(T)),'-b',T,Y(:,4),'--r');
grid on
legend(p,'Bsreal','Bshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Bs (kgs/m) \rightarrow','FontSize',12);
title('Bs vs t','FontSize',15);
figure
p = plot(T,Y(:,5),'-b',T,Y(:,6),'--r',T,Y(:,7),'-.g',T,Y(:,8),':k');
grid on
legend(p,'P11','P12','P21','P22',1);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('P \rightarrow','FontSize',12);
title('P(Gain Matrix) vs t','FontSize',15);
figure
p = plot(T,RD*(log(sec(ktheta*(Y(:,1)+ref(T)))))/(ktheta) ,'-
b',T,RD*tan(ktheta*(Y(:,1)+ref(T))).*(Y(:,2)+refdot(T)),'--r');
grid on
legend(p,'W1','W2',1);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('W \rightarrow','FontSize',12);
title('W (Signal Matrix) vs t','FontSize',15);
world = vrworld('Mechanism_Model.wrl');
open(world);
set(world, 'Description', 'Simulation of the Gear-shift Mechanism for designed
Controller');
view(world);
-7-
vrdrawnow;
d = vrnode(world, 'Drum_Body');
r = vrnode(world, 'Rail');
c = vrnode(world, 'Connector');
f = vrnode(world, 'Fork');
pause;
for i=1:1:length(T)/4+140
d.rotation = [0 1 0 (Y(i,1)+ref(T(i)))];
r.translation = [0 0 RD*(log(sec(ktheta*(Y(i,1)+ref(T(i))))))/(ktheta)];
c.translation = [0 0 31.5+RD*(log(sec(ktheta*(Y(i,1)+ref(T(i))))))/(ktheta)];
f.translation = [0 0 100+RD*(log(sec(ktheta*(Y(i,1)+ref(T(i))))))/(ktheta)];
vrdrawnow;
end
pause;
vrclose
vrclear
clear all;
close all;

function dy = mysystem(t,y)
global Ksreal Bsreal ktheta RD
K_bs = 100;
dy = zeros(9,1);
xr = sin(t);
xrdot = cos(t);
xrdot2 = -sin(t);
n2 = 0.2*sin(20*t);
ny = sin(20*t);
dtdg = ktheta;
theta_val = ktheta*(y(1)+xr);
theta_val_e = ktheta*(y(9)+xr);
f1_val = .3906e-2*cos(theta_val)*(-
.1275e21*sin(theta_val)+.2294e21*cos(theta_val)+.4584e18)/(.6243e20*cos(theta_val)^
2+.3581e18*cos(theta_val)-.8091e20*sin(theta_val)*cos(theta_val)+.1168e21);
f2_val =-
.8896e18*cos(theta_val)*(25.*sin(theta_val)+4.*cos(theta_val))/(.6243e20*cos(theta_
val)^2+.3581e18*cos(theta_val)-.8091e20*sin(theta_val)*cos(theta_val)+.1168e21);
f3_val =.4671e19*dtdg*(25.*sin(theta_val)+4.*cos(theta_val))/cos(theta_val)/(-
.6243e20*cos(theta_val)^2-
.3581e18*cos(theta_val)+.8091e20*sin(theta_val)*cos(theta_val)-.1168e21);
Kshat = y(3);
Bshat = y(4);
W_e = [RD*log(sec(theta_val_e))/(ktheta) RD*tan(theta_val_e)*(y(2)+xrdot+n2)];
W_r = [RD*log(sec(theta_val))/(ktheta) RD*tan(theta_val)*(y(2)+xrdot)];
P = [y(5) y(6);
y(7) y(8)];
u = (-y(2)-n2-y(9)-K_bs*(y(9)+y(2)+n2)-f2_val*Kshat*RD*log(sec(theta_val_e))/ktheta
- (f2_val*Bshat*RD*tan(theta_val_e)+f3_val)*(y(2)+xrdot+n2)-xrdot2)/f1_val;
dy(1) = y(2); %z(gamma-gammaref) zdot(gammadot-gammadotref) Kshat Bshat P(1,1)
P(1,2) P(2,1) P(2,2)
dy(2) = f1_val*u+f2_val*Ksreal*RD*log(sec(theta_val))/ktheta +
(f2_val*Bsreal*RD*tan(theta_val)+f3_val)*(y(2)+xrdot)-xrdot2;
dy(3) = -
(P(1,1)*RD*log(sec(theta_val_e))/(ktheta)+P(1,2)*RD*tan(theta_val_e)*(y(2)+xrdot+n2
))*(W_e*[Kshat Bshat]'-(Ksreal*W_r(1)+Bsreal*W_r(2)+ny));
dy(4) = -
(P(2,1)*RD*log(sec(theta_val))/(ktheta)+P(2,2)*RD*tan(theta_val)*(y(2)+xrdot+n2))*(
W_e*[Kshat Bshat]'-(Ksreal*W_r(1)+Bsreal*W_r(2)));

-8-
dy(5) = -(P(1,1)*W_e(1)+P(1,2)*W_e(2))*(W_e(1)*P(1,1)+W_e(2)*P(2,1));
dy(6) = -(P(1,1)*W_e(1)+P(1,2)*W_e(2))*(W_e(1)*P(1,2)+W_e(2)*P(2,2));
dy(7) = -(P(2,1)*W_e(1)+P(2,2)*W_e(2))*(W_e(1)*P(1,1)+W_e(2)*P(2,1));
dy(8) = -(P(2,1)*W_e(1)+P(2,2)*W_e(2))*(W_e(1)*P(1,2)+W_e(2)*P(2,2));
dy(9) = y(2)+n2;

A.5 MATLAB code for Basic Controller with parameter estimation using linearized
model for asymptotically stabilizing origin (Unknown Coefficient of Friction)
function Basic_Controller_u_unknown
clc;
clear all;
close all;
global Ksreal Bsreal ktheta RD ureal K_bs
K_bs = 1000;
ktheta = 0.5;
RD = 24.5;
ureal = 0.14;
Ksreal = 20;
Bsreal = 30;
u0 = 0.5;
ubar = 0.16;
Kshat0 = 3;
Bshat0 = 4;
a1hat0 = u0-ubar;
a2hat0 = a1hat0*Kshat0;
a3hat0 = a1hat0*Bshat0;
P0 = [0.1:0.1:2.5];
y0 = [0.25 0 a1hat0 Kshat0 a2hat0 Bshat0 a3hat0 P0]; %gamma gammadot a1hat Kshat
a2hat Bshat a3hat P11->P15, P21->P25, P31->P35, P41->P45, P51->P55
[T Y] = ode45(@mysystem,linspace(0,10),y0); %gamma gammadot a1hat Kshat a2hat Bshat
a3hat P11->P15, P21->P25, P31->P35, P41->P45, P51->P55
figure;
plot(T,Y(:,1)*180/pi,'-');
grid on
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Y (deg)\rightarrow','FontSize',12);
title('Y vs t','FontSize',15);
figure
plot(T,Y(:,2)*180/pi,'-r');
grid on
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('dY/dt (deg/s) \rightarrow','FontSize',12);
title('dY/dt vs t','FontSize',15);
figure
plot(T,Ksreal*RD*log(sec(ktheta*(Y(:,1))))/ktheta+Bsreal*RD*tan(ktheta*(Y(:,1))).*Y
(:,2),'-r');
grid on
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ffa (kg) \rightarrow','FontSize',12);
title('Ffa vs t','FontSize',15);
figure
p = plot(T,Ksreal*ones(size(T)),'-b',T,Y(:,4),'--r');
grid on
legend(p,'Ksreal','Kshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ks (kg/mm) \rightarrow','FontSize',12);
title('Ks vs t','FontSize',15);
-9-
figure
p = plot(T,Bsreal*ones(size(T)),'-b',T,Y(:,6),'--r');
grid on
legend(p,'Bsreal','Bshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Bs (kgs/m) \rightarrow','FontSize',12);
title('Bs vs t','FontSize',15);
u = Y(:,3)+ubar;
figure
p = plot(T,ureal*ones(size(T)),'-b',T,u,'--r');
grid on
legend(p,'ureal','uhat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('\mu \rightarrow','FontSize',12);
title('\mu vs t','FontSize',15);
dtdg = ktheta;
Kshat = Y(:,4);
Bshat = Y(:,6);
theta_val = ktheta*Y(:,1);
f1_val =.7812e-
2*cos(theta_val).*(.3528e16*u.^3.*cos(theta_val)+.1411e18*u.^2.*cos(theta_val)-
.4584e16*u.^2+.8750e16*u.*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u.^2.*sin(theta_val)+.2048e18*u.*sin(theta_val))./(.5513e16*u.^3.*cos(thet
a_val).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));
f2_val =-8.*cos(theta_val).*(.6356e15*u.^2.*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u.*cos(theta_val)+.6356e15*u.*sin(theta_val))./(.5513e16*u.^3.*cos(theta_v
al).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));
f3_val
=.5978e17*dtdg*(sin(theta_val)+u.*cos(theta_val))./cos(theta_val)./(.5513e16*u.^3.*
cos(theta_val).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));
f11 =.1562e-1*cos(theta_val).*(.2293e9*cos(theta_val)+.4584e6-
.1275e9*sin(theta_val))./(.2497e9*cos(theta_val).^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val).*cos(theta_val));
f12 =-4.882*cos(theta_val).*(.3153e15*cos(theta_val).^3-.3155e15*cos(theta_val)-
.8563e13*cos(theta_val).^2+.7925e15*sin(theta_val).*cos(theta_val).^2+.8563e13+.685
1e12*sin(theta_val).*cos(theta_val)-
.1186e16*sin(theta_val))./(.4239e17*cos(theta_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);
f21 =-
.3558e7*cos(theta_val).*(4.*cos(theta_val)+25.*sin(theta_val))./(.2497e9*cos(theta_
val).^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val).*cos(theta_val));
f22 =-500.*cos(theta_val).*(.3237e15*cos(theta_val).^3-
.4609e15*cos(theta_val)+.2731e12*cos(theta_val).^2-
.1016e15*sin(theta_val).*cos(theta_val).^2+.3711e14*sin(theta_val)+.3299e13*sin(the
ta_val).*cos(theta_val))./(.4239e17*cos(theta_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);
- 10 -
f31 =-
.1868e8*dtdg*(4.*cos(theta_val)+25.*sin(theta_val))./cos(theta_val)./(.2497e9*cos(t
heta_val).^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val).*cos(theta_val));
f32 =-.4670e9*dtdg*(.1657e10*cos(theta_val).^2-.2479e10+.1432e7*cos(theta_val)-
.6595e9*sin(theta_val).*cos(theta_val)+.1790e8*sin(theta_val))./(.4239e17*cos(theta
_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);
U = (-Y(:,2)-Y(:,1)-K_bs*(Y(:,1)+Y(:,2))-
f2_val.*Kshat*RD.*log(sec(theta_val))./(ktheta)-
(f2_val.*Bshat*RD.*tan(theta_val)+f3_val).*Y(:,2))./f1_val;
W = [f12.*U+f32.*Y(:,2), f21*RD.*log(sec(theta_val))./(ktheta),
f22*RD.*log(sec(theta_val))./(ktheta), f21*RD.*tan(theta_val).*Y(:,2),
f22*RD.*tan(theta_val).*Y(:,2)];
figure
p = plot(T,W(:,1),'-b',T,W(:,2),'--r',T,W(:,3),'-.y',T,W(:,4),':g',T,W(:,5),'-
.ok');
grid on
legend(p,'W1','W2','W3','W4','W5',1);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('W \rightarrow','FontSize',12);
title('W (Signal Matrix) vs t','FontSize',15);
clear all;

function dy = mysystem(t,y)
global Ksreal Bsreal ktheta RD ureal K_bs
dy = zeros(8,1);
dtdg = ktheta;
u = y(3)+0.16;
theta_val = ktheta*y(1);
f1_val =.7812e-
2*cos(theta_val)*(.3528e16*u^3*cos(theta_val)+.1411e18*u^2*cos(theta_val)-
.4584e16*u^2+.8750e16*u*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u^2*sin(theta_val)+.2048e18*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)
^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f2_val =-8.*cos(theta_val)*(.6356e15*u^2*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u*cos(theta_val)+.6356e15*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)^2
+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f3_val
=.5978e17*dtdg*(sin(theta_val)+u*cos(theta_val))/cos(theta_val)/(.5513e16*u^3*cos(t
heta_val)^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f11 =.1562e-1*cos(theta_val)*(.2293e9*cos(theta_val)+.4584e6-
.1275e9*sin(theta_val))/(.2497e9*cos(theta_val)^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val)*cos(theta_val));
f12 =-4.882*cos(theta_val)*(.3153e15*cos(theta_val)^3-.3155e15*cos(theta_val)-
.8563e13*cos(theta_val)^2+.7925e15*sin(theta_val)*cos(theta_val)^2+.8563e13+.6851e1
2*sin(theta_val)*cos(theta_val)-

- 11 -
.1186e16*sin(theta_val))/(.4239e17*cos(theta_val)^4-.3379e18*cos(theta_val)^2-
.7153e15*cos(theta_val)^3+.1616e18*cos(theta_val)^3*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val)*cos(theta_val)+.9271e15*sin(theta_v
al)*cos(theta_val)^2);
f21 =-
.3558e7*cos(theta_val)*(4.*cos(theta_val)+25.*sin(theta_val))/(.2497e9*cos(theta_va
l)^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val)*cos(theta_val));
f22 =-500.*cos(theta_val)*(.3237e15*cos(theta_val)^3-
.4609e15*cos(theta_val)+.2731e12*cos(theta_val)^2-
.1016e15*sin(theta_val)*cos(theta_val)^2+.3711e14*sin(theta_val)+.3299e13*sin(theta
_val)*cos(theta_val))/(.4239e17*cos(theta_val)^4-.3379e18*cos(theta_val)^2-
.7153e15*cos(theta_val)^3+.1616e18*cos(theta_val)^3*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val)*cos(theta_val)+.9271e15*sin(theta_v
al)*cos(theta_val)^2);
f31 =-
.1868e8*dtdg*(4.*cos(theta_val)+25.*sin(theta_val))/cos(theta_val)/(.2497e9*cos(the
ta_val)^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val)*cos(theta_val));
f32 =-.4670e9*dtdg*(.1657e10*cos(theta_val)^2-.2479e10+.1432e7*cos(theta_val)-
.6595e9*sin(theta_val)*cos(theta_val)+.1790e8*sin(theta_val))/(.4239e17*cos(theta_v
al)^4-.3379e18*cos(theta_val)^2-
.7153e15*cos(theta_val)^3+.1616e18*cos(theta_val)^3*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val)*cos(theta_val)+.9271e15*sin(theta_v
al)*cos(theta_val)^2);
Kshat = y(4);
Bshat = y(6);
U = (-y(2)-y(1)-K_bs*(y(1)+y(2))-f2_val*Kshat*RD*log(sec(theta_val))/(ktheta)-
(f2_val*Bshat*RD*tan(theta_val)+f3_val)*y(2))/f1_val;
u = ureal;
f1_val =.7812e-
2*cos(theta_val)*(.3528e16*u^3*cos(theta_val)+.1411e18*u^2*cos(theta_val)-
.4584e16*u^2+.8750e16*u*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u^2*sin(theta_val)+.2048e18*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)
^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f2_val =-8.*cos(theta_val)*(.6356e15*u^2*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u*cos(theta_val)+.6356e15*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)^2
+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f3_val
=.5978e17*dtdg*(sin(theta_val)+u*cos(theta_val))/cos(theta_val)/(.5513e16*u^3*cos(t
heta_val)^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
W = [f12*U+f32*y(2), f21*RD*log(sec(theta_val))/(ktheta),
f22*RD*log(sec(theta_val))/(ktheta), f21*RD*tan(theta_val)*y(2),
f22*RD*tan(theta_val)*y(2)];
P = [y(8) y(9) y(10) y(11) y(12);
y(13) y(14) y(15) y(16) y(17);
y(18) y(19) y(20) y(21) y(22);
y(23) y(24) y(25) y(26) y(27);
y(28) y(29) y(30) y(31) y(32);];
dy(1) = y(2); %gamma gammadot a1hat Kshat a2hat Bshat a3hat P11->P15, P21->P25,
P31->P35, P41->P45, P51->P55,

- 12 -
dy(2) =
f1_val*U+f2_val*(Ksreal*RD*log(sec(theta_val))/(ktheta)+Bsreal*RD*tan(theta_val)*y(
2))+f3_val*y(2);
ahat = [y(3:7)];
ahatdot = -P*W'*(W*ahat-dy(2)-f31*y(2)-f11*U);
for i=1:1:5
dy(i+2) = ahatdot(i);
end
Pdot = P*W'*W*P;
k = 8;
for i=1:1:5
for j=1:1:5
dy(k) = Pdot(i,j);
k = k+1;
end
end

A.6 MATLAB code for Tracking Controller with parameter estimation and
reference output tracking (Unknown Coefficient of Friction)
function Tracking_Controller_u_unknown
clc;
clear all;
close all;
global Ksreal Bsreal ktheta RD ureal K_bs
K_bs = 10;
ktheta = 0.5;
RD = 24.5;
ureal = 0.14;
Ksreal = 5;
Bsreal = 0.1;
u0 = 0.4;
ubar = 0.16;
Kshat0 = 4;
Bshat0 = 0.01;
a1hat0 = u0-ubar;
a2hat0 = a1hat0*Kshat0;
a3hat0 = a1hat0*Bshat0;
P0 = [0.001:0.001:0.025];
ref = @(T) sin(T);
refdot = @(T) cos(T);
y0 = [0.5 -0.5 a1hat0 Kshat0 a2hat0 Bshat0 a3hat0 P0]; %gamma gammadot a1hat Kshat
a2hat Bshat a3hat P11->P15, P21->P25, P31->P35, P41->P45, P51->P55
[T Y] = ode45(@mysystem,[0,10],y0);
figure;
p = plot(T,ref(T)*180/pi,'-b',T,(Y(:,1)+ref(T))*180/pi,'--r');
grid on
legend(p,'Yr','Y',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Y (deg)\rightarrow','FontSize',12);
title('Y vs t','FontSize',15);
figure
p = plot(T,refdot(T)*180/pi,'-b',T,(Y(:,2)+refdot(T))*180/pi,'--r');
grid on
legend(p,'Yrdot','Ydot',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('dY/dt (deg/s) \rightarrow','FontSize',12);
title('dY/dt vs t','FontSize',15);
figure
- 13 -
p =
plot(T,Ksreal*RD*log(sec(ktheta*(ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(ref(T))).*r
efdot(T),...
'-
b',T,Ksreal*RD*log(sec(ktheta*(Y(:,1)+ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(Y(:,1)
+ref(T))).*(Y(:,2)+refdot(T)),'--r');
grid on
legend(p,'Ffar','Ffa',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ffa (kg) \rightarrow','FontSize',12);
title('Ffa vs t','FontSize',15);
figure
p = plot(T,Ksreal*ones(size(T)),'-b',T,Y(:,4),'--r');
grid on
legend(p,'Ksreal','Kshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Ks (kg/mm) \rightarrow','FontSize',12);
title('Ks vs t','FontSize',15);
figure
p = plot(T,Bsreal*ones(size(T)),'-b',T,Y(:,6),'--r');
grid on
legend(p,'Bsreal','Bshat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('Bs (kgs/m) \rightarrow','FontSize',12);
title('Bs vs t','FontSize',15);
u = Y(:,3)+ubar;
figure
p = plot(T,ureal*ones(size(T)),'-b',T,u,'--r');
grid on
legend(p,'ureal','uhat',4);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('\mu \rightarrow','FontSize',12);
title('\mu vs t','FontSize',15);
Y(:,1)=Y(:,1)+ref(T);
Y(:,2)=Y(:,2)+refdot(T);
dtdg = ktheta;
Kshat = Y(:,4);
Bshat = Y(:,6);
theta_val = ktheta*Y(:,1);
f1_val =.7812e-
2*cos(theta_val).*(.3528e16*u.^3.*cos(theta_val)+.1411e18*u.^2.*cos(theta_val)-
.4584e16*u.^2+.8750e16*u.*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u.^2.*sin(theta_val)+.2048e18*u.*sin(theta_val))./(.5513e16*u.^3.*cos(thet
a_val).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));
f2_val =-8.*cos(theta_val).*(.6356e15*u.^2.*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u.*cos(theta_val)+.6356e15*u.*sin(theta_val))./(.5513e16*u.^3.*cos(theta_v
al).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));
f3_val
=.5978e17*dtdg*(sin(theta_val)+u.*cos(theta_val))./cos(theta_val)./(.5513e16*u.^3.*
cos(theta_val).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));
- 14 -
f11 =.1562e-1*cos(theta_val).*(.2293e9*cos(theta_val)+.4584e6-
.1275e9*sin(theta_val))./(.2497e9*cos(theta_val).^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val).*cos(theta_val));
f12 =-4.882*cos(theta_val).*(.3153e15*cos(theta_val).^3-.3155e15*cos(theta_val)-
.8563e13*cos(theta_val).^2+.7925e15*sin(theta_val).*cos(theta_val).^2+.8563e13+.685
1e12*sin(theta_val).*cos(theta_val)-
.1186e16*sin(theta_val))./(.4239e17*cos(theta_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);
f21 =-
.3558e7*cos(theta_val).*(4.*cos(theta_val)+25.*sin(theta_val))./(.2497e9*cos(theta_
val).^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val).*cos(theta_val));
f22 =-500.*cos(theta_val).*(.3237e15*cos(theta_val).^3-
.4609e15*cos(theta_val)+.2731e12*cos(theta_val).^2-
.1016e15*sin(theta_val).*cos(theta_val).^2+.3711e14*sin(theta_val)+.3299e13*sin(the
ta_val).*cos(theta_val))./(.4239e17*cos(theta_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);
f31 =-
.1868e8*dtdg*(4.*cos(theta_val)+25.*sin(theta_val))./cos(theta_val)./(.2497e9*cos(t
heta_val).^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val).*cos(theta_val));
f32 =-.4670e9*dtdg*(.1657e10*cos(theta_val).^2-.2479e10+.1432e7*cos(theta_val)-
.6595e9*sin(theta_val).*cos(theta_val)+.1790e8*sin(theta_val))./(.4239e17*cos(theta
_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);
U = (-Y(:,2)-Y(:,1)-K_bs*(Y(:,1)+Y(:,2))-
f2_val.*Kshat*RD.*log(sec(theta_val))./(ktheta)-
(f2_val.*Bshat*RD.*tan(theta_val)+f3_val).*Y(:,2))./f1_val;
W = [f12.*U+f32.*Y(:,2), f21*RD.*log(sec(theta_val))./(ktheta),
f22*RD.*log(sec(theta_val))./(ktheta), f21*RD.*tan(theta_val).*Y(:,2),
f22*RD.*tan(theta_val).*Y(:,2)];
figure
p = plot(T,W(:,1),'-b',T,W(:,2),'--r',T,W(:,3),'-.y',T,W(:,4),':g',T,W(:,5),'-
.ok');
grid on
legend(p,'W1','W2','W3','W4','W5',1);
xlabel('time (s) \rightarrow','FontSize',12);
ylabel('W \rightarrow','FontSize',12);
title('W (Signal Matrix) vs t','FontSize',15);
clear all;

function dy = mysystem(t,y)
global Ksreal Bsreal ktheta RD ureal K_bs
dy = zeros(8,1);
dtdg = ktheta;
u = y(3)+0.16;
xr = sin(t);
xrdot = cos(t);
xrdot2 = -sin(t);
dtdg = ktheta;
theta_val = ktheta*(y(1)+sin(t));
f1_val =.7812e-
2*cos(theta_val)*(.3528e16*u^3*cos(theta_val)+.1411e18*u^2*cos(theta_val)-

- 15 -
.4584e16*u^2+.8750e16*u*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u^2*sin(theta_val)+.2048e18*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)
^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f2_val =-8.*cos(theta_val)*(.6356e15*u^2*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u*cos(theta_val)+.6356e15*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)^2
+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f3_val
=.5978e17*dtdg*(sin(theta_val)+u*cos(theta_val))/cos(theta_val)/(.5513e16*u^3*cos(t
heta_val)^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f11 =.1562e-1*cos(theta_val)*(.2293e9*cos(theta_val)+.4584e6-
.1275e9*sin(theta_val))/(.2497e9*cos(theta_val)^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val)*cos(theta_val));
f12 =-4.882*cos(theta_val)*(.3153e15*cos(theta_val)^3-.3155e15*cos(theta_val)-
.8563e13*cos(theta_val)^2+.7925e15*sin(theta_val)*cos(theta_val)^2+.8563e13+.6851e1
2*sin(theta_val)*cos(theta_val)-
.1186e16*sin(theta_val))/(.4239e17*cos(theta_val)^4-.3379e18*cos(theta_val)^2-
.7153e15*cos(theta_val)^3+.1616e18*cos(theta_val)^3*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val)*cos(theta_val)+.9271e15*sin(theta_v
al)*cos(theta_val)^2);
f21 =-
.3558e7*cos(theta_val)*(4.*cos(theta_val)+25.*sin(theta_val))/(.2497e9*cos(theta_va
l)^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val)*cos(theta_val));
f22 =-500.*cos(theta_val)*(.3237e15*cos(theta_val)^3-
.4609e15*cos(theta_val)+.2731e12*cos(theta_val)^2-
.1016e15*sin(theta_val)*cos(theta_val)^2+.3711e14*sin(theta_val)+.3299e13*sin(theta
_val)*cos(theta_val))/(.4239e17*cos(theta_val)^4-.3379e18*cos(theta_val)^2-
.7153e15*cos(theta_val)^3+.1616e18*cos(theta_val)^3*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val)*cos(theta_val)+.9271e15*sin(theta_v
al)*cos(theta_val)^2);
f31 =-
.1868e8*dtdg*(4.*cos(theta_val)+25.*sin(theta_val))/cos(theta_val)/(.2497e9*cos(the
ta_val)^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val)*cos(theta_val));
f32 =-.4670e9*dtdg*(.1657e10*cos(theta_val)^2-.2479e10+.1432e7*cos(theta_val)-
.6595e9*sin(theta_val)*cos(theta_val)+.1790e8*sin(theta_val))/(.4239e17*cos(theta_v
al)^4-.3379e18*cos(theta_val)^2-
.7153e15*cos(theta_val)^3+.1616e18*cos(theta_val)^3*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val)*cos(theta_val)+.9271e15*sin(theta_v
al)*cos(theta_val)^2);
Kshat = y(4);
Bshat = y(6);
U = (-y(2)-y(1)-K_bs*(y(1)+y(2))-f2_val*Kshat*RD*log(sec(theta_val))/(ktheta)-
(f2_val*Bshat*RD*tan(theta_val)+f3_val)*(y(2)+xrdot)-xrdot2)/f1_val;
W = [f12*U+f32*(y(2)+xrdot), f21*RD*log(sec(theta_val))/(ktheta),
f22*RD*log(sec(theta_val))/(ktheta), f21*RD*tan(theta_val)*(y(2)+xrdot),
f22*RD*tan(theta_val)*(y(2)+xrdot)];
P = [y(8) y(9) y(10) y(11) y(12);
y(13) y(14) y(15) y(16) y(17);
y(18) y(19) y(20) y(21) y(22);
y(23) y(24) y(25) y(26) y(27);
y(28) y(29) y(30) y(31) y(32);];
- 16 -
u = ureal;
f1_val =.7812e-
2*cos(theta_val)*(.3528e16*u^3*cos(theta_val)+.1411e18*u^2*cos(theta_val)-
.4584e16*u^2+.8750e16*u*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u^2*sin(theta_val)+.2048e18*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)
^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f2_val =-8.*cos(theta_val)*(.6356e15*u^2*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u*cos(theta_val)+.6356e15*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)^2
+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f3_val
=.5978e17*dtdg*(sin(theta_val)+u*cos(theta_val))/cos(theta_val)/(.5513e16*u^3*cos(t
heta_val)^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
dy(1) = y(2); %z(gamma-gammaref) zdot(gammadot-gammadotref) a1hat Kshat a2hat Bshat
a3hat P11->P15, P21->P25, P31->P35, P41->P45, P51->P55
dy(2) = f1_val*u+f2_val*Ksreal*RD*log(sec(theta_val))/ktheta +
(f2_val*Bsreal*RD*tan(theta_val)+f3_val)*(y(2)+xrdot)-xrdot2;
ahat = [y(3:7)];
ahatdot = -P*W'*(W*ahat-(dy(2)+xrdot2)-f11-f31*(y(2)+xrdot));
for i=1:1:5
dy(i+2) = ahatdot(i);
end
Pdot = P*W'*W*P;
k = 8;
for i=1:1:5
for j=1:1:5
dy(k) = Pdot(i,j);
k = k+1;
end
end

- 17 -

Vous aimerez peut-être aussi