First order systems
Visual Cue  Narration 

Show first slide 
Hello and welcome to the first tutorial on Control Systems. In this tutorial, we will show how to represent first order control systems and determine some of their properties. In order to practice this tutorial, you will need to have Scilab installed on your computer. Open the Scilab window. 
Open Scilab 

First, we see how to define a simple first order system. For this, we need the complex domain variable, s. We can define this thus:  
s = poly(0, 's') 
Scilab provides us with a shorter and quicker alternative to typing all of this since the variable 's' is used very often. 
s = %s 
The complex domain variable, 's', is stored in Scilab as a symbolic constant, as is the variable 'z'. We now proceed to defining the gain and time constant of the system 
K = 1, T = 1 
And now we define the system: 
SimpleSys = syslin('c', K/(1 + T*s)) 
This uses the function 'syslin' which is used to define linear systems. The argument 'c' is used to specify the domain of the system to be continuous time. This function can also be used to define discrete time systems or sampled systems. 
Now we simulate the system using a step test. Let us perform a step for 15 seconds and see the response.  
t=0:0.01:15; y1 = csim('step', t, SimpleSys); 
The function 'csim' is used to simulate a continuoustime linear system using various types of inputs. The string 'step' can be used to specify a unit step input to the system 'SimpleSys' over time 't'. We will come to other types of inputs shortly. The output of this simulation is stored in the variable 'y1' which we plot versus 't'. 
plot(t, y1) 
As expected, we obtain an exponential response corresponding to <math>\frac{1}{1 + s}</math> 
Now we wish to simulate the system with a different input. We can specify any input we want by passing it as a vector to the 'csim' function. Let us simulate this system with a sine test.  
u2=sin(t); y2 = csim(u2, t, SimpleSys); plot(t, [u2; y2]) 
This plots both the input and the output on the same graph. As expected, the output is also a sine wave. Let us now change the frequency of the input. 
u3=sin(5*t); y3 = csim(u3, t, SimpleSys); plot(t, [u3; y3]) 
Now we see that the sine wave is attenuated and the phase lag is increased. This is expected since <math>\frac{1}{1 + s}</math> corresponds to a low pass filter. 
We can generate the root locus of this sytem using the 'evans' command.  
evans(SimpleSys) Zoom in around the pole. 
We can verify that the pole is indeed at 1 by zooming around the pole. We will see later how to find the gain of the closed loop system from a point on the root locus. 
We can also plot the Bode plot quite easily. For this, we must define the frequency bounds for which we want to see the bode plot. We choose 0.01Hz to 10Hz.  
fMin=0.01, fMax=10 bode(SimpleSys, fMin, fMax) 
We note that this Bode plot corresponds to the Bode plot for a low pass filter, as expected.
