I have an equation that produces a value for constant acceleration, and produces a straight line graph. I need to find the corresponding values for velocity and displacement and plot their graphs as well over a period of time. I tried using cumtrapz(a), but my values for vel and disp turn out to be zero. How can I integrate the acceleration w.r.t time?

댓글 수: 1

Roger Stafford
Roger Stafford 2016년 11월 16일
편집: Roger Stafford 2016년 11월 16일
For a constant acceleration, the velocity will be the initial velocity plus the constant acceleration multiplied by the time. The displacement will be the initial displacement plus the initial velocity multiplied by the time plus half the acceleration multiplied by the square of the time. Why bother with having matlab do the integration when such a simple method is available?
The time to use matlab would be with an acceleration that varies with time and/or with distance.

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

답변 (1개)

Star Strider
Star Strider 2016년 11월 16일

1 개 추천

See if something like this does what you want:
t = 0:4; % Time Vector
Accel = 1.5 * ones(1, 5); % Acceleration Vector
Vel = cumtrapz(t, Accel); % Velocity Vector
Disp = cumtrapz(t, Vel); % Displacement Vector
figure(1)
plot(t, Accel)
hold on
plot(t, Vel)
plot(t, Disp)
hold off
grid
legend('Acceleration', 'Velocity', 'Displacement', 'Location','NW')

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

A
A
2016년 11월 16일

편집:

2016년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by