Project - Position control of mass spring damper system
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
AIM :
creating a model of the transfer function of a mass spring damper system and utilising it to develop a project for position control of the system. Add a PID controller to the system to change the force acting on the mass so that it follows a reference signal.
OBJECTIVE:
Utilise the transfer function of a mass spring damper system in the model. Add a PID controller to the system to change the force acting on the mass so that it follows a reference signal. the Matlab model of the pulse waveform generator with pid control and transfer function.
A regulated mass spring-damper is illustrated in this example. To make a mass position follow a command signal, a controller modifies the mass's force. The mass's first-order velocity is source to track the step changes to the input signal.
PID controller
In this project, PID controller has been designed by using Simulink in order to control a mass spring damper system which can move any direction. A transfer function for dc motor was added on the diagram. Response curve of the PID controller were fixed by tuning. The computer interface, different control algorithms can be performed on the system easily; control parameters can be set up online, filter algorithms in various structures can be tried and the reaction of these changeable values to the system can be observed. The effects of controller Proportional Integral Derivative (PID) for developing.

TRANSFER FUNCTION :
The numerator coefficient can be a vector or matrix expression. The denominator coefficient must be a vector. The output width equals the number of rows in the numerator coefficient. You should specify the coefficients in descending order of powers of s.
'Parameter tunability' controls the runtime tunability level for numerator and denominator coefficients. 'Auto': Allow Simulink to choose the most appropriate tunability level. 'Optimized': Tunability is optimized for performance. 'Unconstrained': Tunability is unconstrained across the simulation targets.
MATLAB PROGRAM CODE:
clc;
close all;
% initial conditions Position control of mass spring damper sys
m = 3.6;
k = 400;
c = 100;
% Pole placement design
fn = 1.0; % 1Hz natural frequency design
wn = 2*pi*fn; % Natural frequency in rad/s
% A & B matrix value
A = [0 1; -k/m -c/m]; % A is using matrix of c ans k dived value of mass
B = [0; 1/m]; % B is the 1 ovear mass value
zeta = 0.5; % for an under-damped behavior
% Desied poles value
p1 = -zeta*wn+wn*sqrt(zeta^2-1);
p2 = -zeta*wn-wn*sqrt(zeta^2-1);
p= [p1;p2];
% place comment is the Kp and Kd value
K = place(A,B,p); % Kp = K(1), Kd = K1(2)
end

Matlab Simulink Model Of Position control of mass spring damper system ::
The model in the previously produced model needs to undergo the following adjustments in order to design a closed loop control system for a DC motor.
Since speed is the variable that may be controlled, we will set the reference speed in step block to 10, 20, as desired.
To create the error signal e(t), subtraction the actual speed from the reference speed is required.
Kd and Kp, which are parameters determined by the place command (K=place(A,B,P)), should be added. (Use the gain block to mention Kp, Kd, and Ki values.)
The output current of the plant or model serves as the feedback for Kd . OR, we might use feedback (error speed signal as Kd's input, as indicated
manually add Ki with gain and Tune the integrator block with various values of Ki and assess the effects on the outcomes.
The following command ('pzmap '-pole zero placement or mapping) can be used in addition to the script above to check the positions of poles on the s-plane in MATLAB. Two crosses in red that show complicated poles lying on the left side of the plane suggest that the system is stable.
Simulink model :

To Plot output Wavefrom :

CONCLUSION :
To complte the project of Position control of mass spring damper system 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 to using matlab and simulink wave from plot.