%%% mass- spring-damper system %%% evaluate the free evolution and the step response clear all close all clc %%% define the parameters b=4 ; % N/m*s m=1; % Kg k=4; %N/m % with these parameters zita=1 and omega_n=2 % define the ss repres. % define A, B, C and D A=[0 1; -k/m -b/m]; B=[0;1/m]; C=[1 0]; D=0; sys=ss(A,B,C,D); s=tf('s'); % define the tf W=1/m/(s^2+ b/m*s + k/m); %or [num,den]=ss2tf(A,B,C,D); % define the intial condition x0=[1;0]; figure(1) hold on grid on initial(sys,x0) figure (2) hold on grid on step(W) %%% reduce b b1=b/10; %%% re-define A1=[0 1; -k/m -b1/m]; sys1=ss(A1,B,C,D); W1=1/m/(s^2+ b1/m*s + k/m); %%% increase b b2=10*b; %%% re-define A2=[0 1; -k/m -b2/m]; sys2=ss(A2,B,C,D); W2=1/m/(s^2+ b1/m*s + k/m); figure(1) initial(sys1,sys2,x0) hold on grid on figure(2) hold on grid on step(sys1,sys2)