# How quarter car modeling on MATLAB?

38 views (last 30 days)
Mustafa Furkan on 22 Dec 2022
Edited: KARTHIK on 15 Nov 2023
I am trying to model the quarter suspension model in Inman's engineering vibration book in MATLAB, but I have not made any progress. The vehicle will move on the sinusoidal path as in the figure and the height of the road is 5 cm.
I want to plot the largest vibration amplitude of the vehicle for the speed range v=[0 200] km/h and the total vibration for r=0.3 for the time interval t=[0 20] s. The average vehicle weight will be M=1000 kg. I predict the spring stiffness to be K=140 kN/m, damping coefficient c=900 Ns/m.
Image Analyst on 22 Dec 2022
Do you have any formulas at all? The Crystal Ball Toolbox is still under development so I cannot currently see your engineering vibration book.
Mustafa Furkan on 22 Dec 2022
@Image Analyst Although the values are different, if I want to solve this problem analytically, it will be a solution like the image above.

Sam Chak on 23 Dec 2022
Edited: Sam Chak on 23 Dec 2022
I prefer the simulation-based numerical solution over the formula-based analytical solution in the example because there is no graph provided in your image.
By Newton's 2nd law, we should get
where the disturbance force caused by the wavy road surface is given by
.
Thus, the model can be rewritten as
,
where the road surface is given by . I believe you can use calculus to find .
The following is based on the info in Example 2.4.2 (provided by you).
tspan = linspace(0, 20, 20001);
x0 = [0 0]; % initial rest condition
[t, x] = ode45(@quarterCar, tspan, x0);
plot(t, x(:,1)), grid on, xlabel('Time, [seconds]'), ylabel('Deflection, [meter]')
title('Deflection experienced by the car')
% Maximum deflection experienced by the car (same as in Example 2.4.2)
dmax = max(x(:,1)) - min(x(:,1))
dmax = 0.0320
% Quarter Car suspension model
function xdot = quarterCar(t, x)
xdot = zeros(2, 1);
% Example 2.4.2
m = 1007; % mass of car
c = 2000; % damping coefficient
k = 4e4; % stiffness coefficient
h = 1; % road height in cm
v = 20; % car velocity (fixed speed)
% Original Problem
% m = 1000; % mass of car
% c = 900; % damping coefficient
% k = 140e3; % stiffness coefficient
% h = 5; % road height in cm
% v = (200/20)*t; % car velocity ramp up from 0 to 200 km/h in 20 seconds
% Standard formulas and state-space model (1st-order ODE form)
wb = 0.2909*v; % formula given in Example 2.4.2
a = (h/2)/100; % sinusoidal amplitude in m
d = k*a*sin(wb*t) + c*a*wb*cos(wb*t); % disturbance due to wavy road surface
A = [0 1; -k/m -c/m]; % state matrix
B = [0; 1/m]; % input matrix
xdot = A*x + B*d;
end
KARTHIK on 15 Nov 2023
Thank you @Sam Chak. Code is working fine
KARTHIK on 15 Nov 2023
Edited: KARTHIK on 15 Nov 2023
@Sam Chak Sir, Please guide me for this problem by ode45
I tried with above provided code, I couldnot able to feed this function.
I need to plot amplitude vs velocity

Sulaymon Eshkabilov on 23 Dec 2022
Hi,
Your system equation is: M*ddx+C*dx+K*x = F(t) and you are studying a forced vibration.
There are a few different ways how to model and solve this spring-mass-damper system.
(1) To obtain an analytical solution, use a symbolic math function: dsolve()
(2) To obtain an analytical solution, use symbolic math functions: laplace(), ilaplace()
(3) To obtain a numerical solution, use ode solvers: ode45, ode23, ode113, etc
(4) To obtain a numerical solution, use Simulink modelling: ode45, ode23, ode113, etc
(5) To obtain a numerical solution, write a code using Euler, Runge-Kutta and other methods
(6) To obtain a numerical solution, use control toolbox functions: tf(), lsim()
There are a few nice sources how to model and solve this spring-mass-damper system.
(6) https://www.mathworks.com/matlabcentral/fileexchange/95288-mass-spring-damper-1-dof
Nice sim demo: https://www.mathworks.com/matlabcentral/fileexchange/94585-mass-spring-damper-systems
Mustafa Furkan on 23 Dec 2022
Thank you. I've reviewed all of your examples before. I'm new to MATLAB so I'm having trouble implementing it. I don't know how to apply range values or draw related graphs.

### Categories

Find more on Assembly in Help Center and File Exchange

R2022b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!