% Program "tra_llm.m" to demonstrate use of Matlab in % transient response analysis of a linear control system % Parameter values of model L = 0.01 ; %inertance in units of cm H2O s2/L C = 0.1 ; %compliance in units of L/cm H2O R = 1 ; %resistance in units of cm H2O s/L lambda = 1 ; %open-loop case % set up transfer function num = [1]; den = [L*C R*C lambda]; Hs = tf(num,den); % generate time vector t = [0:0.005:0.8]; % compute and plot impulse response x = impulse(Hs,t); plot(t,x); disp(' Press to continue >>'); pause; % compute and plot step response y = step(Hs,t); figure; plot(t,y); disp(' Press to continue >>'); pause; % compute and plot response to arbitrary input, u (square wave) [u,t]=gensig('square',0.5,5,0.005); y=lsim(Hs,u,t); figure; plot(t,y)