% % open loop driver-- examine the response of the plant by itself % % put in some stuff for the ECP 210 system % this sets the value of the limiter % saturation_level = 1000/2196; % % now load the plant model % the model is in state space form and we need to % convert it to transfer function form % don't worry about this for now % load state_model_1dof C = [1 0]; [num_Gp,den_Gp] = ss2tf(A,B,C,D); % % % clean up the transfer function by setting small values to 0 % tol = 1e-7; % anything smaller than this is set to zero % % you are not responsible for the following voo doo % num_Gp = (abs(num_Gp) > tol*ones(1,length(num_Gp))).*num_Gp; den_Gp = (abs(den_Gp) > tol*ones(1,length(den_Gp))).*den_Gp; % % now construct the transfer function and display it % Gp = tf(num_Gp,den_Gp); disp('Gp is : '); Gp % % set the step amplitude and final time % Amp = 0.1; % cm for the ECP 210 system Tf = 5.0; % seconds % % now simulate the system % sim('openloop'); % % plot the results % orient landscape % plot sideways subplot(2,1,1); plot(m_time,m_y); grid; xlabel('Time (sec)'); ylabel('Position (cm)'); subplot(2,1,2); plot(m_time,m_u); grid; xlabel('Time (sec)'); ylabel('Control Effort');