**4.1. MATLAB code implementing Smith Predictor**

To analyse the system performance with a Smith Predictor structure it was developed a MATLAB code and a SIMULINK model. The mathscript code is presented below, with a Pade approximation to represent the time delay. The polynomial ratio used at the next code represents a delay of 3 seconds with the ratio of two second order polynomials. The block association was developed through the use of the association commands *series* and *feedback*.

Representing the Smith Predictor in a MATLAB code:

% Smith Predictor

clc clear all close all

s=tf('s')

% Delay with Pade aproximation [num\_d,den\_d]=pade(3,2)

```
% PI Control System 
Kp=2; 
Ti=15; 
G=Kp*(1+(1/(Ti*s)));
```
H=tf(num\_d,den\_d) Gc=feedback(G,series((1-H),(0.26/(23\*s+1))))

CL=feedback(series(Gc,series(tf(num\_d,den\_d),0.26/(23\*s+1))),1)

figure(1) step(CL,200) grid

It is possible to see that the association Gc represents the control algorithm, where G is the Proportional Integral controller designed to the plant without delay. The system designed with SIMULINK model is presented at figure 9.

At the next figure the step response obtained at the end of the program. It is possible to see that the stationary error is equal to zero and that the control parameters could be adjusted to obtain a small overshoot.

**Figure 9.** Smith Predictor in SIMULINK model.

design specification plus the dead time present at the original plant.

**4.1. MATLAB code implementing Smith Predictor** 

Representing the Smith Predictor in a MATLAB code:

% Smith Predictor

% PI Control System

G=Kp\*(1+(1/(Ti\*s)));

H=tf(num\_d,den\_d)

obtain a small overshoot.

% Delay with Pade aproximation [num\_d,den\_d]=pade(3,2)

Gc=feedback(G,series((1-H),(0.26/(23\*s+1))))

with SIMULINK model is presented at figure 9.

CL=feedback(series(Gc,series(tf(num\_d,den\_d),0.26/(23\*s+1))),1)

It is possible to see that the association Gc represents the control algorithm, where G is the Proportional Integral controller designed to the plant without delay. The system designed

At the next figure the step response obtained at the end of the program. It is possible to see that the stationary error is equal to zero and that the control parameters could be adjusted to

 clc clear all close all

 s=tf('s') 

figure(1) step(CL,200)

grid

Kp=2; Ti=15;

At figure 8 it is possible to verify that G(s) may be designed considering the transfer function F(s) without the time-delay. The transfer function of the complete system has the

To analyse the system performance with a Smith Predictor structure it was developed a MATLAB code and a SIMULINK model. The mathscript code is presented below, with a Pade approximation to represent the time delay. The polynomial ratio used at the next code represents a delay of 3 seconds with the ratio of two second order polynomials. The block association was developed through the use of the association commands *series* and *feedback*.

**Figure 10.** Closed loop system response.

**Figure 11.** Controller output.

The output of the controller must be verified after the control system design to avoid the saturation of the actuators.
