Project - Position control of mass spring damper system
1)
In order to Obtain the transfer function of a mass spring damper system,
we use the laplace transfer.
first case
here, we use the transfer fuction and PID block to obtain the output, PIDblock automatically generates the values of ki,kd,and kp.according to the input.

plot

seccond case-manual method
we need define the values script file in matlab.
m=3.6;
c=100;
k=400;
A=[0 1; -k/m c/m];
B=[0;1/m];
% placement of the poles
fn=1.0; %wn/(2*pi) Hz
wn=sqrt(k/m)
% design parameters
zeta=0.9; % underdamping condition
% %desired poles
p1=-zeta*wn+wn*sqrt(zeta^2-1);
p2=-zeta*wn-wn*sqrt(zeta^2-1);
P=[p1,p2];
K=place(A,B,P)
Kp=K(1);
Kd=K(2);
then adjut the ki value as per the signal.

plot

we observe the both plot, we obtained the desired output