%Defining model parameters:
tu=5; %Time of step in u
u0=0; %Value of u before the step
u1=2; %Value of u after the step
T=0.5; %Time constant
K=2; %Gain
tau=0.5; %Time delay
x0=4; %Initial value of x
T_array=[0.25 0.5 1 2]; %Four T values.
%Setting simulation parameters:
timestep=0.01;
options=simset('solver','ode5','fixedstep',timestep); 
tstop=10;
%Running a sequence of simulations:
for k=1:length(T_array)
 T=T_array(k); %A new T value is fetched from the array.
 sim('sys1workspace',tstop,options)
 %Saves responses in x as columns in x_matrix:
 x_matrix(:,k)=x; 
end %for
%Plots x_matrix and u as functions of t:
figure(1);
plot(t,x_matrix,t,u)
title('u (dashed) and x for T=0.25, 0.5, 1 and 2.')
xlabel('t [sec]')
