How to create a sinusoidal bump for car in road?
25 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
This equation for paper: "PID Control of a Nonlinear Half-Car Active Suspension System via Force Feedback ".
In Matlab I code:
a=0.11;%(m)
v=20; %(m/s)
lamda=5;%(m)
lf=1;
lr=1.5;
tf=second(0:20)
td=1+(lf+lr)/v
tr=tf+td
if 1<=tf <=1+(lamda/v)
td=1+(lf+lr)/v;
tr=tf+td;
wf=(a/2)*(1-cos(2*pi*(v/lamda)*tf))
wr=(a/2)*(1-cos(2*pi*(v/lamda)*tr))
else
td=0;
tr=0;
wf=0;
wr=0;
end
tf is a time function and I just want it run from 0 to 20 second and continuous ( to put it in my Simulink project). And Matlab show tf is matrix vector. Hope you guy can help me to create that sinusoidal bump. Thank you very much <3
0 commentaires
Réponse acceptée
Sam Chak
le 12 Fév 2023
Hi @Nguyen Hieu
Instead of using the If-Else statement, I took the pure math approach of describing the shapes of the road bumps.
By the way, I think there is an error in the profile, where the profile should be defined over the interval .
a = 0.11; % (m)
V = 20; % (m/s)
lambda = 5; % (m)
lf = 1;
lr = 1.5;
Tspan = 5; % Can be changed to 20 seconds
Tf = linspace(0, Tspan, 1000*Tspan+1);
T1 = 1;
T2 = T1 + lambda/V;
wf = (a/2)*(1 - cos((2*pi*V*Tf)/lambda)).*(heaviside(Tf - T1) - heaviside(Tf - T2));
Td = T1 + (lf + lr)/V;
Tr = Tf + Td;
T3 = Td + lambda/V;
wr = (a/2)*(1 - cos((2*pi*V*Tr)/lambda)).*(heaviside(Tf - Td) - heaviside(Tf - T3));
plot(Tf, wf), hold on
plot(Tf, wr, '--'), grid on
xlabel('Time, (sec)'),
ylabel('Road Disturbance, w (m)')
title('Road Profiles')
annotation('textarrow', [1/5 1.45/5], [0.08/0.12 0.07/0.12], 'String', 'w_{f}')
annotation('textarrow', [2/5 1.65/5], [0.08/0.12 0.07/0.12], 'String', 'w_{r}')
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Multibody Modeling dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!