Linear Sliding Mode Controller (State Feedback)
Design sliding mode control with knowledge of linear systems using state feedback
Since R2025a
Libraries:
Simulink Control Design /
Sliding Mode
Description
Use the Linear Sliding Mode Controller (State Feedback) block to implement Sliding Mode Control (SMC) based on a class of uncertain linear systems using a state feedback approach. This block offers the major benefit of providing two methods to automatically design the sliding surface based on a linear plant model. You can use the Sliding Mode Controller (Reaching Law) block to support a generic nonlinear plant model (), though you need to design the sliding surface C yourself. In contrast, with the Linear Sliding Mode Controller (State Feedback) block, which is based on a nominal linear plant model, you can automatically design the sliding surface using the provided methods.
With this block, you can implement SMC in the following modes of operation:
Regulation mode — Use this mode when you want to drive the system states x(t) to zero.
Reference tracking mode — Use this mode when you want the system output y(t) to follow a specified reference signal r(t).
Model reference tracking mode — Use this mode when you want the system states x(t) to track predefined reference model states xm(t).
For each mode, you can either specify the sliding matrix S explicitly or design the matrix using one of following two methods:
Pole Placement — This method assigns the eigenvalues of the closed-loop system during the sliding mode to achieve the desired dynamic characteristics.
Quadratic Minimization — This method designs the matrix S such that the system minimizes a quadratic performance index, expressed as:
Additionally, you can choose a reaching law to control the rate of convergence to the sliding surface and a boundary layer to minimize chattering effects. For more information about SMC, see Sliding Mode Control.
Examples
Stabilize Chua System Using Sliding Mode Controller
Design sliding mode controller to stabilize a chaotic system.
- Since R2025a
- Open Live Script
Sliding Mode Control of DC Motor
Design SMC for reference tracking for a DC motor.
- Since R2025a
- Open Live Script
Ports
Input
System states, specified as an nx-by-1 signal, where nx is the number of states.
Data Types: single
| double
Reference trajectory to follow in the tracking mode, specified as an ny-by-1 signal, where ny is the number of outputs.
The reference signal must be differentiable.
Dependencies
To enable this port, set Task Mode to Reference Tracking or Model-Reference Tracking.
Data Types: single
| double
Derivative of the reference signal, specified as an ny-by-1 signal, where ny is the number of outputs.
Use this port when you want to provide the derivative of reference signal from an external input. Otherwise, the block computes the derivative during simulation.
Dependencies
To enable this port:
Set Switching Function to Reference Tracking.
Enable Include derivative reference signal.
Data Types: single
| double
Output
Computed control action, returned as an nu-by-1 signal, where nu is the number of inputs.
Data Types: single
| double
Switching function value, returned as an nu-by-1 signal, where nu is the number of inputs.
Dependencies
To enable this port, enable the Output Switching Function parameter.
Data Types: single
| double
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Model Parameters
State matrix of the system, specified as a square matrix of size nx-by-nx, where nx is the number of states. Here, the system is a class of uncertain linear systems with a nominal model defined by:
The pair (A,B) must be controllable.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | A |
Values: | "[0 1; 0 0]" (default) | square matrix |
Example: set_param(gcb,"A","[1 2; 3
1]")
Input matrix of the system, specified as a matrix of size nx-by-nu, where nx is the number of states and nu is the number of inputs. Here, the system is a class of uncertain linear systems with a nominal model defined by:
The pair (A,B) must be controllable.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | B |
Values: | "[0; 1]" (default) | matrix |
Example: set_param(gcb,"B","[2;
3]")
Output matrix of the system, specified as a matrix of size ny-by-nx, where nx is the number of states and ny is the number of outputs. Here, the system is a class of uncertain linear systems with a nominal model defined by:
The system (A,B,C) must be completely controllable and have no invariant zeros at the origin.
Dependencies
To enable this parameter, set Task Mode to Reference Tracking.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | C |
Values: | "[1 0]" (default) | matrix |
Example: set_param(gcb,"C","[2
3]")
Reference Model Parameters
State matrix of the reference model, specified as a square matrix of size nx-by-nx, where nx is the number of states. In the model-reference tracking mode, the specified system states x(t) track the reference model states xm(t).
The pair (Am,Bm) must be controllable and the reference model must be stable, that is, eigenvalues of Am have negative real parts.
Dependencies
To enable this parameter, set Task Mode to Model-Reference Tracking.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | Am |
Values: | "[0 1; 0 0]" (default) | square matrix |
Example: set_param(gcb,"Am","[1 2; 3
1]")
Input matrix of the reference model, specified as a square matrix of size nx-by-nu, where nx is the number of states and nu is the number of inputs. In the model-reference tracking mode, the specified system states x(t) track the reference model states xm(t).
Dependencies
To enable this parameter, set Task Mode to Model-Reference Tracking.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | Bm |
Values: | "[0; 1]" (default) | matrix |
Example: set_param(gcb,"Bm","[2;
3]")
Sliding Surface Tab
Block mode of operation, specified as one of the following:
Regulation — Use this mode when you want to drive the system states x(t) to zero.
Reference Tracking — Use this mode when you want the system output y(t) to follow a specified reference signal r(t).
Model-Reference Tracking — Use this mode when you want the system states x(t) to track predefined reference model states xm(t).
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | TaskMode |
Values: | "Regulation" (default) | "Reference Tracking" | "Model-Reference Tracking" |
Example: set_param(gcb,"TaskMode","Reference
Tracking")
Select to return the sliding surface value at an output port s(x).
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | EnableSwitchingFunction |
Values: | "off" (default) | "on" |
Example: set_param(gcb,"EnableSwitchingFunction","on")
Select to specify the derivative of state reference signal externally at the input port r.dot.
Dependencies
To enable this parameter, set Task Mode to Reference Tracking.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | EnableTrackingDerivative |
Values: | "off" (default) | "on" |
Example: set_param(gcb,"EnableTrackingDerivative","on")
Design matrix to govern the reduced-order motion in the reference tracking mode, specified as a scalar or matrix of size ny-by-ny, where ny is the number of outputs.
In reference tracking mode, the switching function is defined by:
Dependencies
To enable this parameter, set: Task Mode to Reference Tracking and enable Include derivative reference signal.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | Sr |
Values: | "0.1" (default) | scalar or matrix in quotes |
Example: set_param(gcb,"Sr","eye(2)")
Tuning method for designing sliding surface S, specified as one of the following:
Pole Placement — This method assigns the eigenvalues of the closed-loop system during the sliding mode to achieve the desired dynamic characteristics. To specify the pole locations, use the Pole Location parameter.
Quadratic Minimization — This method designs the matrix S such that the system minimizes a quadratic performance index, expressed as:
To specify the matrix Q, use the Weighted Matrix parameter.
User-Defined Matrix (S) — Explicitly define the sliding surface matrix. To specify the matrix, use the block parameter S.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | Tuning |
Values: | "Pole
Placement" (default) | "Quadratic Minimization" | "User-defined Matrix (S)" |
Example: set_param(gcb,"Tuning","Quadratic
Minimization")
Pole location when designing sliding surface S using pole placement method, specified as a column vector of one of the following sizes:
(nx – nu)-by-1 when Task Mode is set to either Regulation or Model-Reference Tracking.
(nx – nu + ny)-by-1 when Task Mode is set to Reference Tracking.
Dependencies
To enable this parameter, set Tuning Method to Pole Placement.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | PoleLocation |
Values: | "-1" (default) | column vector in quotes |
Example: set_param(gcb,"PoleLocation","[-2;-3]")
Weighted matrix for quadratic performance index when designing sliding surface S using the quadratic minimization method, specified as a square matrix with one of the following sizes:
nx-by-nx when Task Mode is set to either Regulation or Model-Reference Tracking.
(nx + ny)-by-(nx + ny) when Task Mode is set to Reference Tracking.
Use the weighting matrix to penalize state deviations based on the assigned weight. This is the same notion as Q matrix in LQR design.
Dependencies
To enable this parameter, set Tuning Method to Quadratic Minimization.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | WeightedMatrix |
Values: | "eye(2)" (default) | matrix in quotes |
Example: set_param(gcb,"WeightedMatrix","[3 0; 0
1]")
When you click this button, the block creates a variable in the MATLAB workspace containing the designed hyperplane matrix S.
Dependencies
To enable this parameter, set Tuning Method to Pole Placement or Quadratic Minimization.
User-defined hyperplane matrix (S), specified as a matrix with one of the following sizes:
nu-by-nx matrix when Task Mode is set to either Regulation or Model-Reference Tracking.
nu-by-(nx + ny) when Task Mode is set to Reference Tracking.
The matrix S determines the hyperplane to which the sliding mode control drives the system states.
Dependencies
To enable this parameter, set Tuning Method to User-defined Matrix (S).
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | S |
Values: | "[0; 1]" (default) | matrix |
Example: set_param(gcb,"Bm","[2;
3]")
Reaching Law Tab
Reaching law h(s(x)) for the sliding surface, specified as one of the following.
Constant Rate
—This law provides a constant rate to reach the sliding surface. Here, θ(si) is the boundary layer and ηi is the reaching rate of the ith control input.
Exponential
—This law adds a term proportional to the sliding variable and provides a more aggressive convergence when the state deviation is significant. Here, Ki is the control gain term that scales the control effort associated with the ith sliding variable.
Power Rate
—This law provides fast reaching speed when the state is far away from the sliding surface, but reduces the speed as the state gets near. This ensures reduced chattering and provides fast convergence.
Unit Vector
—Here, P2 is the solution of the Lyapunov equation .
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | ReachingLaw |
Values: | "Constant Rate" (default) | "Exponential" | "Power Rate" | "Unit Vector" |
Example: set_param(gcb,"ReachingLaw","Power
Rate")
Reaching rate (η), specified as a positive scalar or a column vector of positive values with length equal to the number of control inputs.
Reaching rate determines the rate at which the system trajectory approaches the sliding surface. A larger value of η results in a faster convergence to the sliding surface but can also lead to higher control effort, which is not desirable in all cases due to potential issues like actuator saturation or increased chattering.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | ReachingRate |
Values: | "0.01" (default) | positive scalar in quotes | column vector in quotes |
Example: set_param(gcb,"ReachingRate","0.05")
Control gain of the proportional term in the exponential reaching law, specified as a positive scalar or column vector of length equal to the number of control inputs. In the exponential reaching law, this term increases the control effort proportional to the deviation from the sliding surface.
Dependencies
To enable this parameter, set Reaching Law to
Exponential
or Unit
Vector
.
Programmatic Use
To get the block parameter value
programmatically, use the get_param
function.
Parameter: | ControlGain |
Values: | "0.01" (default) | positive scalar in quotes | column vector in quotes |
Example: set_param(gcb,"ControlGain","2")
Exponent value in the power rate reaching law, specified as a positive scalar between 0 and 1 or column vector of length equal to the number of control inputs. This parameter determines the nonlinearity of the control action with respect to the distance from the sliding surface. Specifically, it adjusts how the control effort scales with the magnitude of the sliding variable. The value of α influences the smoothness of the approach to the sliding surface. The lower values lead to a softer approach and potentially reduce chattering.
Dependencies
To enable this parameter, set Reaching Law to
Power Rate
.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | PowerRate |
Values: | "0.01" (default) | positive scalar between 0 and 1 in quotes | column vector of positive values between 0 and 1 in
quotes |
Example: set_param(gcb,"PowerRate","0.02")
Boundary layer function, specified as one of the following:
Sign
—This option uses the default signum function and switches between –1 and 1 discontinuously.
Relay
—This option uses a relay function to define the switching boundary around the sliding surface.
Hyperbolic Tangent
—This option uses a hyperbolic tangent function to define the switching boundary around the sliding surface.
Saturation
—This option uses a saturation function to smoothly interpolate between –1 and 1 when the sliding variable is within the boundary layer [–ϕ,ϕ], which reduces the high-frequency switching.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | BoundaryLayer |
Values: | "Sign" (default) | "Relay" | "Hyperbolic Tangent" | "Saturation" |
Example: set_param(gcb,""BoundaryLayer,"Saturation")
Boundary layer thickness parameter, specified as a positive scalar or column vector of length equal to the number of control inputs.
This parameter defines the boundary layer thickness around the sliding surface. A larger Phi value results in less chattering but can increase the steady-state error. Conversely, a smaller Phi value can reduce steady-state error but increase chattering.
Dependencies
To enable this parameter, set Select Boundary Layer to any one of these values:
Relay
Hyperbolic Tangent
Saturation
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | Phi |
Values: | "0.01" (default) | positive scalar in quotes | column vector in quotes |
Example: set_param(gcb,"Phi","0.05")
Select to enable zero-crossing detection. For more information, see Zero-Crossing Detection.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | ZeroCross |
Values: | "off" (default) | "on" |
Example: set_param(gcb,"ZeroCross","on")
Block Tab
Specify the controller time domain.
When you select Discrete-Time, specify the sample time using the Sample time parameter.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | TimeDomain |
Values: | "Continous-Time" (default) | "Discrete-Time" |
Example: set_param(gcb,""TimeDomain,"Discrete-Time")
Sample time of the block, specified as a positive scalar. The block uses this value to sample the input-output data.
Dependencies
To enable this parameter, set the Time domain property to Discrete-Time.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | SampleTime |
Values: | "-1" (default) | positive scalar in quotes |
Example: set_param(gcb,"DiscreteTs","0.5")
You can select one of the following integration methods for the discrete-time integrators.
Forward Euler
:Backward Euler
:Trapezoidal
:
Here:
y is the integrator output
u is the input
n is the current sample time
Ts is the sample time
For more information about discrete-time integration, see Discrete-Time Integrator.
Dependencies
To enable this parameter, set Time domain to Discrete-Time.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | IntegratorMethod |
Values: | "Forward Euler" (default) | "Backward Euler" | "Trapezoidal" |
Example: set_param(gcb,"IntegratorMethod","Trapezoidal")
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2025a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)