Question: Write a MATLABfunction, a .m file, that will simulate a ball bouncing in a square box. The material has the perfect elasticity, no energy is

Write a MATLABfunction, a .m file, that will simulate a ball bouncing in a square box. The material has the perfect elasticity, no energy is lost for each impact. We will also assume that there is no air resistance so the velocity will stay a constant.

The box has a dimension of 20x20 in the default unit. The origin of the coordinate system is at the center of the box with x being the horizontal axis and y being the vertical axis.Initially, the ball will be placed at the origin.

Your program will ask the user to input the magnitude of the velocity and the angle between the velocity vector and the x-axis. It will then calculate and plot the position of the ball in a graph window. The title of the graph will be your name Homework 2, see the image below.The red dot in the graph window indicates the current position of the ball.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!