%% First Order System Example for 25AUG2015 Lecture % BJ Furman % 24AUG2015 %% Normalized first order response % Consider normalizing the expression for V(t): $ln\left ( \frac{V}{V_{0}} \right )= e^{-\frac{t}{\tau }}$ clear all close all t = linspace(0,1,500); % time vector R = 10000; % Ohms C = 10e-6; % Farads tau = R*C % seconds figure Vnorm = exp(-t/tau); plot(t,Vnorm) grid title('Normalized First Order Response') ylabel('Response') xlabel('Time, s') %% Family of curves using for loop and hold clear all close all t = linspace(0,1,500); % time vector R = 10000; % Ohms C = 10e-6; % Farads tau = R*C % seconds taus = tau*[0.25, 1, 2, 10]; %figure hold for n = 1:length(taus) plot(t,exp(-t/taus(n))) end grid legend(num2str(taus(1)),num2str(taus(2)),num2str(taus(3))) %% Family of response curves using vectorization clear all close all t = linspace(0,1,500); % time vector R = 10000; % Ohms C = 10e-6; % Farads tau = R*C % seconds taus = tau*[0.25, 1, 2]; % The outer product is used to create a matrix of length(taus) columns % of length(t) rows. The ./ is used to take the reciprocal of each element % of taus Vnorm = exp(-t'*(1./taus)); figure plot(t,Vnorm) grid title('Normalized First Order Response') ylabel('Response') xlabel('Time, s') legend(strcat('\tau = ',num2str(taus(1))),strcat('\tau = ',num2str(taus(2))),strcat('\tau = ',num2str(taus(3)))) %%