Project - Position control of mass spring damper system
question :Obtain the transfer function of a mass spring damper system and use it in the model. Add a PID controller to adjust the force on mass so that its position follows a reference signal.
soluation : the transfer function for the spring mass damper system is derived on the paper attach in the below fig . and the value of natural frequency and other constant are calculated in the program .m file 
here for this example i take the zeta value of 1.001 (near to critically damped system )
the block diagram of the simulation is attached in below .

the transfer function block is used to implement the spring damper system equation
the program used to run the simulation and calculated all the values

the value of propertion gain (Kp) and derivative gain(Kd) is taking from the place command place(A,B,p) where the first value of k i.e K(1) is refer to the propertional gain Kp and second value of K is refer the derivative gain Kd and the value of integral gain Ki is manually varying untill getting the satisfied output
case 1 Ki = 200 ; the value of Ki is set to 200 and output graph is shown below which is not desired .

case 2 Ki = 400

again the output get's corrected little bit but we need to increase the value of ki again
case 3 Ki = 600

again it corrected little bit
case no 04 Ki =700

case5 ki = 805

case 6

if the value of set the 900 the output singnal get's little bit of overshoot therefor the value above the 900 is not considerable the ideally the Ki is in somewhere in between the 800 to 900
from above all the cases it is observe that if the value of ki is 200 is time the ouput signal is not follow the ouput . but as increasing the value of Ki from 200 to 400 and 400 to 600 and 600 to 800 it is observe the time taking to reach the final value or we can say that output is betterly follow the input waveform untill the value of ki = 800 . but when the value of Ki is increasing to 900 it get's overshoot and system get's unstable and that gives the singnal of ideal value of Ki is lies between the 800 to 900 . (NOTE for this eg i consider the value of zeta = 1.001)