필터 지우기
필터 지우기

How to create a sinusoidal bump for car in road?

조회 수: 11 (최근 30일)
Nguyen Hieu
Nguyen Hieu 2023년 2월 12일
댓글: Nguyen Hieu 2023년 2월 14일
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

채택된 답변

Sam Chak
Sam Chak 2023년 2월 12일
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}')
  댓글 수: 1
Nguyen Hieu
Nguyen Hieu 2023년 2월 14일
It works, thank you very much. I need to use this time function in my Simulink project, and it must to be a continous signal. Can you develope your code to made wf and wr to be continous signal ? Thank you again.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by