Project - Position control of mass spring damper system
Qus.1.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.
Take m = 3.6; %kg k = 400; %N/m c = 100; %Ns/m
The reference signal is shown in the following figure.

Ans:-
Code:-

Command window:-

Simulink model:-

Input signal:-

Result(Output):-

Summary:-
In this challange i used simple harmonic oscillator method.
first i take the value of m,k and c as given in qus.
then i take fn=1 with the help of fn i find the value of wn.
then i find the value of A and B with the help of all the values.
then i find the value of p1 and p2.
and then with the place command i find the value of kp and kd.
the script file as shown above.
then i make model as shown above.
create the input signal as shown in above figure.
then with help of all values run the model, and got the output as shown in above figure.