How to find the time for the max height of the rocket. MATLAB
조회 수: 83 (최근 30일)
이전 댓글 표시
Hi there! Doing a little final practice and was asked to find the max height and the time of the max height of the rocket. I can't figure out the code for the time.
function rocket
g=9.81;
vi=50;
yi=0;
theta=(pi/3);
t=0:0.1:12;
x=vi*cos(theta)*t;
y=yi+vi*sin(theta)*t-((1/2)*g*(t.^2));
plot(t,y)
Maxheight=max([y(:)])
end
댓글 수: 0
채택된 답변
Walter Roberson
2018년 1월 5일
[Maxheight, timeindex] = max(y);
Now timeindex tells you which entry in y was maximum, and you can use that index to figure out what the corresponding time was.
댓글 수: 2
추가 답변 (1개)
Image Analyst
2018년 1월 6일
See my attached demo for a projectile, which computes just about everything you could possibly think to measure.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Oil, Gas & Petrochemical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!