% mysos % clear command window and variable memory clc clear % define 2nd order system parameters wn = .1; % natural frequency z = .1; % damping constant % step response n = [wn^2]; d = [1 2*z*wn wn^2]; g = tf(n, d); step (g) % pause for the user display ('Hit Enter to continue'); pause figure % create new plot window % frequency response w = 0 : wn/10 : 5*wn; gjw = freqs(n, d, w); gmag = abs (gjw); plot (w, gmag); % alternative method: %gjw = freqresp (g, w); %gmag = abs (gjw); %[m n] = size(w); %i = 1 : n; %yw(i) = gmag (1, 1, i); %plot (w, yw); % pause for the user display ('Hit Enter to continue'); pause % remove figures close all clc