How to make the ball bounce back?
1 view (last 30 days)
Show older comments
I need to create a function(filename, v_yo, COR, bounces) which returns (t, Y, Vy) where t = time; Y = vertical position of the ball; Vy = velocity at at time t and position Y.Lastly, I need to plot two graphs. One graph of v_yo vs t and another of Y vs t So far I've got function [ t,Y,Vy ] = function(fileName,v_yo,COR,bounces). I don't know how to make the ball bounce back up. Time stays constant and Y keeps declining, I need to make Y go up and down as time passes according to the COR (constant of restitution = (velocity at impact)/(velocity before impact). Any help is greatly appreciated!!
g = 9.81; %m/s^2 t = 0:.1:10; Y =(v_yo*t - .5*g*t.^2); Vy = (v_yo + g*t);
dlmwrite(fileName,[t',Y',Vy'],'delimiter', '\t','precision', '%.6f'); subplot(2,1,1) plot(t', Y') subplot(2,1,2) plot(Vy', Y') end
0 Comments
Answers (1)
See Also
Categories
Find more on 2-D and 3-D Plots 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!