BASKET SHOT 3D ANİMATİON
23 views (last 30 days)
Show older comments
function projmotion(x0,y0,v0,theta)
g = 9.81;
theta=45;
v0=50;
y0=50;
x0=50;
z0=50;
angle = theta*(pi./180);
hangtime = 2*v0*sin(angle)/g;
t = hangtime;
vix = v0*cos(angle);
viy = v0*sin(angle);
viz = v0*cos(angle)*sin(angle)*t
x = x0+vix*t;
y = y0+viy*t-(g*t.^2)/2;
z = z0+viz*t;
maxheight = y0 + (viy)^2./(2*g)
xheight = x0 + vix*(t/2);
zheight = z0 + viz*t + 2
if theta >90
error('Please select angle value of 90 degrees or less')
end;
figure('Color', [1 1 1]);
for k=0:t/100:t
x = x0 +(vix*k);
y = y0 +(viy*k)-0.5*g*(k^2);
Z = z0 +(viz*k);
end
for k=0:t/100:t
x = x0 +(vix*k);
y = y0 +(viy*k)-0.5*g*(k^2);
Z = z0 +(viz*k)
h = plot3(x,y,z,'.');
xlabel('Horizontal Distance (meters)');
ylabel('Height (meters)');
zlabel('Z');
title('Basket shot animation');
set(h,'MarkerSize',10);
set(h,'Color',[1,0.3,0.5]);
grid on
hold on;
pause(0.02);
end
Answers (0)
See Also
Categories
Find more on Animation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!