VLab 1
VLab 1
clear all
tvec=0:0.01:20; %creates a time vector from 0 to 20seconds with 0.01second
intervals
u=tvec.^0;
%creates the unit step input
[t,y]=ode45(@tank_control,tvec,[0],[],u,tvec,'height'); %creates response
of transfer function and stores them in a vector y
plot(tvec,y) %Plots y vs time
xlabel('Time(s)')
ylabel('Output Value')
title('Time Response of system')
The plot shows the time response of a system to unit step input. The transfer function used was:
( )
( )
Matlab Code:
clear all
tvec=0:0.001:2; %creates a time vector from 0 to 2seconds with 0.001second
intervals
u=(exp(-(tvec.^2))).*cos(3.*tvec); %creates the input
[t,y]=ode45(@tank_control,tvec,[0],[],u,tvec,'height'); %creates response
of transfer function and stores them in a vector y
plot(tvec,y) %Plots y vs time
xlabel('Time(s)')
ylabel('Output Value')
title('Time Response of system')
The plot shows the time response of a system to input u. The transfer functions used were:
( )
( )
( )
( )