% Step Response Script
% This script will plot the step respose of a low-pass RC filter
% using the parameters defined below. The time axis will be plotted
% in terms of time constants (i.e. normalized by RC).
%
% Written by Kevin D. Donohue 9-7-2004 (donohue@engr.uky.edu)
R = 1000; % Resistance value
C = 1e-6; % Capacitor value
A = 10; % Voltage (max amplitude) of input step
tc = R*C; % Compute circuits time constant
% Time axis Limits in terms of time constants
num_o_tc = 5; % Number of time constants for length of time axis
sample_int = .01; % time inteval as a fraction of the time constant
t = [0 : tc*sample_int : num_o_tc*tc]; % Create time axis from 0
vc = A*(1-exp(-t/tc)); % Compute step response
figure % Open new figure window put plot
plot(t/tc, vc); % Normalize time axis by time constant and plot response
xlabel('Time in Number of Time Constants') % Label x-axis
ylabel('Amplitude') % Label y-axis