Question: The problem is to create a program in MATLAB in GUI or GUIDE to simulate a basketball shooting game. The question now is to edit
The problem is to create a program in MATLAB in GUI or GUIDE to simulate a basketball shooting game. The question now is to edit the code to show the parabola of the ball to determine whether it goes in or not.
I already have the following
function parabola() fprintf ('WELCOME TO THE GAME '); fprintf ('Choose distance of the basket: '); fprintf ('1. 25m 2. 40m '); distance = input('Enter 1 or 2: '); u = input('Enter the initial velocity of the basketball: '); a = input('Enter the angle at which you want to shoot: '); % calculate the range R = (u*u)*sin(2*a); R = R/9.8; if (R == distance) fprintf (' You have won!'); else fprintf (' Sorry, better luck next time.'); end end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
