Project - Position control of mass spring damper system
Ans:
Consider m is mass , K is spring constant and C is damping coefficient of spring.
the transfer functionis derived as below
Z(s)/F(s)=1/(m*s^2+c*s+k)
Find the poles to be stable.
Obtain the A and B matrices to pace ploes.
A=[0 1;
-k/m -c/m]
B=[0 1/m]
Obtain reference signal by setting pulse genarator paramters as below
Amplitude=1, No of samples =10 and pulse widt 5.
Define spring mass system paramters in script as below
% Take paramters for spring mass damper sytem as given
m=3.6; %kg
k=400; %N/m
c=100; %Ns/m
% assume
fn=1; %1hz
wn=6.2832;
zeta=0.5; %underdamped system
x10=0.01; x20=0; %initial conditions assumed
p1=-zeta*wn+wn*sqrt(zeta^2-1);
p2=-zeta*wn-wn*sqrt(zeta^2-1);
P=[p1;p2];
A=[0 1;... %x1_dot=x2
-k/m -c/m]; %x2_dot=-k/m*x1-c/m*x2+1/m*u
B=[0; 1/m];
K=place(A ,B, P);
ki=2000;
K(1)=900;
the simulink model is as below

The output position is following the ref input signal as below

Matlab codes file and Simulink files and Scope output file attached .
Run the files and adjusted ki and Kp to get the desired output.
end.