Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

This objectives of this problem are to give you experience creating MATLAB functions, using iteration, and solving a numerical problem in MATLAB.
You will write a program that computes the trajectory of a ball. Your main script will prompt for the ball's initial angle (in degrees), velocity (in meters per second), an initial height above the ground (in meters), and a time interval between each coordinate pair (in
seconds). For this simulation, we will assume the ground is level, the ball is traveling in a vacuum. You will compute the coordinates of the ball at uniform time intervals, until the ball is on or in the ground.
Theory
Because we are computing the trajectory in a vacuum on a flat world, the equations of motion are very simple. Assume that the initial velocity is , the initial angle of the velocity vector is , and the initial height is . We can compute the initial components of the velocity vector as:
Since there is no force acting on the horizontal direction, we know the horizontal component of the acceleration vector is:
and hence the horizontal component of the velocity vector is constant:
Thus the position at time is
Derivation of the vertical vector components is similarly easy. Since the only vertical force is gravity, the vertical component of the acceleration vector is:
where m/s2 is the gravitational constant on earth. Integrating over time, we find:
We also find:
Program Specifications
Create a function, calculate_path, with the following inputs and outputs:
[tp,xp,yp,xv,yv] = calculate_path(ang, v0, y0, dt, ft)
This computes points on the trajectory when the initial height in meters is y0, the angle in degrees is ang, the initial speed in m/s is v0, and the time step is dt. The results include horizontal positions in xp and vertical components in yp, where each (xp(i), yp(i)) the
coordinates of ball at time tp(i), which is (i-1)*dt. The other results are horizontal components of velocity in xv, and vertical components of velocity in yv, where each (xv(i), yv(i)) are vector velocity components at time t(i). The value of the last element of yp should be <= 0, or the last element of tp should be >= tp, the final time. In other words, calculate the trajectory until either the ball has hit the ground, or it has been in flight for ft seconds, whichever comes first.
You must also create a script, homework2.m, that will prompt for the initial height, angle,velocity, and time step. The script will then call calculate_path to compute the points of the trajectory. The script will print the time of the final step in the trajectory, and the speed
of the ball at that time. Finally, the script will plot the trajectory in a figure.
You must turn in your homework2.m script, your calculate_path function, and any other functions you might create to solve this problem. Be sure your work is well commented! In particular, don't forget the heading comments in your main script indicating who the
programmers are, etc.
Sample Output
Running the script might produce output like this:
Please enter the initial speed of the ball (m/s): 1000
Please enter the initial height of the ball (m): 500
Please enter the angle of velocity from horizontal (degrees): 30
Please enter the time step (seconds): 0.1
Please enter the final time (seconds): 500
Final time is:
103.1000
Final speed is:
1.0052e+03
>>
This would create a plot like this:
Other Notes
We will be using and modifying the calculate_path function in other homework problems,so it is important that you follow the specification shown here. You will want to keep it for future assignments. As for your script, you may embellish it as you please, as long as the result is basically what is specified here. Please do not animate output, but feel free to add legends to the axes, draw a cannon to launch the ball, etc. But none of this is required.
Grading
This assignment will be graded out of 100 points, assigned as follows:
• Properly commented: 20
• There is a proper calculate_path function, with the proper parameters and return values: 10 points for the correct name, 5 points for the correct return values, 
• The calculate_path function uses iteration: 
• The calculate_path function computes correct results: 
for positions, 10 points for velocities. These are results are all vectors.
• The trajectory is plotted:
• The final velocity is correctly computed:

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9653773

Have any Question?


Related Questions in Computer Engineering

Flyers inc just paid an eps of 49 this year flyers is

Flyers, Inc., just paid an EPS of $4.9 this year. Flyers is expected to maintain a retained earnings ratio of 50% and ROE of 5.5% for the next five years. After the fifth year, ROE is expected to decrease to 3.3%. Applyi ...

You run a computer network support business servicing

You run a computer network support business servicing home/office and small business clients, and one of your SMC clients wants to experiment with IPv4-toIPv6 migration on the Windows 7 computers in her office. She has s ...

How do you calculate the number of atoms given the weight

How do you calculate the number of atoms given the weight of an element, such as nitrogen?

Suppose users share a 2 mbps link also suppose each user

Suppose users share a 2 Mbps link. Also suppose each user transmits continuously at 1 Mbps when transmitting, but each user transmits only 20 percent of the time. When a circuit switching is used, how many users can be s ...

Subject is foundations of information technologyresearching

Subject is Foundations of Information Technology. Researching Web 2.0 Write a 5- to 7-page APA formatted research paper on any of the following topics. Research any associated tools, new developments, and benefits/disadv ...

What does the super keyword represents and where can it be

What does the super keyword represents and where can it be used? Give an example of a superclass and subclass. Be sure to make all the instances variables of the super class private. Include at least one constructor in e ...

Suppose a coworker approaches you and asks what an ethical

Suppose a coworker approaches you and asks what an ethical hacker does. She does not understand the role that an ethical hacker plays in the security industry and assumes that such a hacker intentionally causes damage. E ...

Salesthe sales department is in a unique position customers

Sales The sales department is in a unique position: customers seek out Thermo-Chem because it has cornered the market with virtually no competition except in the chemicals market. Therefore, only limited sales effort is ...

For the following c statement what is the corresponding

For the following C statement, what is the corresponding RISC-V assembly code? Assume that the variables f, g, h, and i are given and could be considered integers as declared in a C program. Use a minimal number of assem ...

Question resource security planning and risk management

Question: Resource: Security Planning and Risk Management Template The CIO of the organization you chose is ready for you to take a look at the organization's potential vulnerabilities and threats. Complete the 1.5- to 2 ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As