Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Baseball_Model_1S To solve trajectory of baseball hit by bat
- %Define initial conditions
- vel = 40; %launch speed m/s
- angle = 20; %launch angle in degrees
- vx = vel*cosd(angle);
- vy = vel*sind(angle);
- ic = [0 vx 0 vy]; %initial conditions
- %timesteps to evaluate model 10 secs
- t = 0:0.05:5;
- %ODE options to determine precision of model
- options = odeset('RelTol',1e-4,'AbsTol',[1e-4,1e-4,1e-4,1e-4]');
- [T,Y] = ode45(@Baseball_Model_1F,t,ic,options); %runs the model
- %plotted results
- plot(Y(:,1),Y(:,3));
- xlabel('Horizontal Distance (m)')
- ylabel('Vertical Distance (m)')
- axis equal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement