To obtain the transfer function of a mass-spring-damper system, we can start with the equation of motion for the system:
m * x'' + c * x' + k * x = F
where x is the displacement of the mass, m is the mass, c is the damping coefficient, k is the spring constant, F is the external force applied to the mass, and ' denotes differentiation with respect to time.
Taking the Laplace transform of the above equation and assuming zero initial conditions, we get:
s^2 * M(s) + c * s * X(s) + k * X(s) = F(s)
where M(s), X(s), and F(s) are the Laplace transforms of m, x, and F, respectively. Solving for X(s), we get:
X(s) = F(s) / (s^2 * M(s) + c * s + k)
Substituting the given values of m, c, and k, we get:
X(s) = F(s) / (3.6 * s^2 + 100 * s + 400)
This is the transfer function of the mass-spring-damper system.
Lets us Input the following in a Matlab script to:
clear all;
clc;
% Parameters
m = 3.6; % kg
k = 400; % N/m
c = 100; % Ns/m
zeta = c / (2 * sqrt(k * m));
wn = sqrt(k / m);
Let us provide a some reference gain values (Kp, Kd, Ki):
% Proportional, integral, and derivative gains
Kp = 100;
Ki = 10;
Kd = 50;
Let us use the below simulink model with a Pulse generator as a reference signal:
Let us plot for above gain values we get :
Let us change the gain values to Kp = 1000; Ki = 0; Kd = 100:
Let us change the gain values to Kp = 5000; Ki = 0; Kd = 500:
Let us change the gain values to Kp = 5000; Ki = -10; Kd = 500:
Let us change the gain values to Kp = 7500; Ki = 50; Kd = 550:
Let us change the gain values to Kp = 7500; Ki = 50; Kd = 750:
By further increasing and adjusting the gain values we can make the position plot to follow the reference signal plot.