Write a function ball that calculates the trajectory of a volleyball in 2 dimensions numerically using the Euler method

조회 수: 18 (최근 30일)
Write a function ball that calculates the trajectory of a volleyball in 2 dimensions numerically using the Euler method. The initial values x(0) und v(0) should be passed to the function. It should return a matrix for the place x(t) and velocity v(t), respectively, that contain the values for all time instances in the columns (rows contain the values for the two dimensions). Stop the calculation when the ball hits the floor. The trajectory should be plotted and the values of time of flight and maximum range should be calculated.
  댓글 수: 1
Jan
Jan 2018년 5월 2일
This is a homework question. Of course the forum will not solve your homework, because this would not be productive. So please post what you have tried so far and ask a specific question. Then we can assist you.

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

답변 (1개)

Prajit T R
Prajit T R 2018년 5월 2일
Hi Munther
Check out this code:
clear x,y,theta,u,n,g,h,u0;
x(1) = 0;
y(1) = 0; g = 9.81; h = 5; u0 = 80;
theta = pi / 6;
u(1) = u0*sin(theta);
for n=2:10
x(n) = x(n - 1) + v0*cos(theta)* h;
u(n) = u(n - 1) - h*g;
y(n) = y(n-1) + h*u(n-1);
end
plot(x,y);
You can work on modifying this code to suit your requirement. I hope this would be a good starting point to help you with your problem.
Cheers

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by