Analysis of LTI Systems

Using the Controls Toolbox

 

 

RLC Circuit

 

·       Consider the RLC circuit below.

 

 

·       The Laplace Transfer function is given by

 

 

                                                         

 

·       Enter the transfer function polynomials to create a MATLAB representation of the system

 

numerator=[1,0,1e6];

denominator=[1,1000,1e6];

sys = tf(numerator, denominator)

 

·       You can now use MATLAB to compute and display many characteristics of the system

 

pzmap(sys)                   % pole zer plot (roots of numerator and demoninator)

freqs(numerator,denominator)    % frequency response in rads/second

impulse(sys)                 % impulse repsone

step(sys)              % step response

 

·       To interactively create any number of plots use the following command.  Go to Edit -> Plot Configurations to create various plots and combinations of plots.

 

ltiview(sys)

 

·       Now let us create a signal to process with the system.  Any data array can be used, but the following command is a simple way to generate standard periodic functions.  This will generate a sin wave of period 1/160 (160Hz) that goes from 0 seconds to 0.05 seconds

 

[x,t]=gensig('sin',1/160,.05);

 

·       To simulate the processing of this signal, use the lsim() command as follows:

 

y=lsim(sys,x,t);

 

·       Now let us display the results

 

figure

subplot(211)

plot(t,x)

xlabel('t (sec) ');

ylabel('x(t) (Volts) ');

title('Input');

axis([0,.05,-1,1])

subplot(212)

plot(t,y)

xlabel('t (sec) ');

ylabel('y(t) (Volts) ');

title('Output');

axis([0,.05,-1,1])

 

·       This circuit is a band-stop filter and is designed to remove frequencies around 160Hz.  Thus, the output is much smaller than the input at this frequency.

 

·       To simulate a frequency sweep, where sinusoidal signals with a range of frequencies are applied to the system, we can use a movie.

 

figure % new figure

f=linspace(100,200,10);  % range of frequencies to try

 

for k = 1 : length(f)

 

[x,t]=gensig('sin',1/f(k),.05);  % generate the k’th sinusoid

y=lsim(sys,x,t); % simulate the output for this signal

 

% plot results

plot(t,x, 'b-',t,y, 'r-')

xlabel('t (sec) ');

ylabel('x(t),y(t) (Volts) ');

title('RLC Circuit Input/Output');

axis([0,.05,-1,1])

text(.01,.75,sprintf('f=%.2f',f(k)))

legend('Input', 'Output')

 

% take “snapshot”

M(k)=getframe;

 

end

 

% play movie

movie(M,10,5)