In simple, every control system has a specific transfer function. Sometimes, engineers must test the control system by applying different inputs to see the output or response of the system. The standard inputs are ‘unit’, ‘ramp’, and ‘step’. You can also apply different kinds of inputs.
Here we show you how to test a transfer function with different inputs with the ‘lsim()’ command. You can try the code below in your Matlab® software.
For example, we want to test a transfer function like below with a square wave.
TF = (s+6.7016)(s+0.298)/[(s+2)(s+3)(s+4)];
Take a look at the code below;
>> a = [-6.7016; -0.2984]; b = [-4;-3;-2]; c = ; sys = zpk(a,b,c) [x, y] = gensig('square', 5, 30, 0.01); lsim(sys,x,y) sys = (s+6.702) (s+0.2984) -------------------- (s+4) (s+3) (s+2) Continuous-time zero/pole/gain model. >>
In this code, we created two column vectors ‘a’ and ‘b’ that includes the roots of the numerator and denominator of the transfer function. To define the transfer function of the control system inside the ‘lsim()’ command, we combined these vectors with the ‘zpk()’ command. And we attached this ‘zpk()’ command to a variable called ‘sys’.
With the ‘gensig()’ command, we created the required test signal to be applied to the input of the transfer function.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
Finally, in the ‘lsim()’ command, we used the ‘sys’ and the variables of the ‘gensig()’ command. The output response of the transfer function to that signal will be given as Amplitude/time chart like below.
So, it is very basic to test different types of signals on different transfer functions of control systems in Matlab® with the ‘lsim()’ command.
Do not forget to leave your comments and questions below about the use of the ‘lsim()’ command in Matlab® below.
If you want further coding examples about the ‘lsim()’ command in Matlab®, inform us in the comments.
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®