How to 3D plot a bouncing ball
이전 댓글 표시
Plot 5 bounces, x and y velocities are constant.
Here is what Ive got...

All of this was done long hand.. I know there is another way but i dont know how...
What the plot should look like...

So how do I do this?
답변 (2개)
Chad Greene
2014년 10월 7일
for n bounces, say 7:
v_z(1) = 17.82;
for n = 2:7
v_z(n) = .8*v_z(n-1);
end
t = 2*v_z/g;
성빈
2022년 10월 6일
0 개 추천
I think it's too late, however... here's the complete code.
close all;
clear all;
alpha=25;
theta=30;
g = 9.81;
b=5;
v_0=20;
%v_x and v_y = constant
v_x = v_0*sind(theta)*cosd(alpha);
v_y = v_0*sind(theta)*sind(theta);
%v_z depreciates by 80% after every bounce
v_z = [17.82 14.256 11.405 9.124 7.299 5.839];
%time between each bounce t_b = (2*v_z)/g
t = [0 3.633 6.543 8.873 10.733 12.221];
for num = 1:1:5
tt = t(num):0.001:t(num+1);
xx = v_x*tt;
yy=v_y*tt;
zz=v_z(num)*(tt - t(num)) - 0.5*g*(tt-t(num)).^2;
plot3(xx,yy,zz);
hold on;
end
hold off;
xlabel('x');ylabel('y');zlabel('z');title('bouncing ball');
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!