% class_demo_1_call.m
% class demo of Transfer fcn, XY Graph and Stop Simulation blocks
clc, clear all, close all

K=2; wn=0.5; zeta=0.25;
% K=2; wn=0.5; zeta=0.05;
% K=2; wn=0.5; zeta=1.5;

T=0.1;
tfinal=500;

if zeta>1 % Case 1
    s1=-zeta*wn+sqrt((zeta^2)-1)*wn;
    tau=-1/s1;
else % Case 2 or Case 3
    tau=1/(zeta*wn);
end

tstop=5*tau; % stop simulation when t>= tstop
estop=0.005; % stop simulation when |ydot|<=estp
sim('class_demo_1')