Sign in to comment. Sign in to answer this question. Unable to complete the action because of changes made to the page. Reload the page to see its updated state. Choose a web site to get translated content where available and see local events and offers.
Based on your location, we recommend that you select:. Select the China site in Chinese or English for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Toggle Main Navigation. Search Answers Clear Filters. Answers Support MathWorks. Search Support Clear Filters. Support Answers MathWorks. Search MathWorks. MathWorks Answers Support. Open Mobile Search. Trial software. You are now following this question You will see updates in your activity feed. You may receive emails, depending on your notification preferences.
How do I create a projectile motion function with the input of angle which is scalar, and time which is a vector. Martin Lacza on 24 Oct Vote 0. Commented: Jean Ramirez on 29 Nov Accepted Answer: Jan. So far I have this code, which succesfully plots the graph of a projectile at the given velocity v and constant g The input is a which is angle and time which is the amount of seconds after launch.
I got stuck here because in the input a has to stay a scalar but time has to be a vector, so I can input more values for time, and the output would be more graphs with the same a angle, but in different times since the launch. How can I make time a vector and have more plotted graphs as the output? Jan on 24 Oct Cancel Copy to Clipboard.
The question is not clear. Definint time as a vector is not meaningful in consequence, while a variatin of the angle would be interesting.A common problem in video games is to calculate the angle to launch a projectile to hit a target.
Each time this problem comes up I tend to grab a pen and pad to re-solve it from scratch. Want to skip the words and see the final result? Even if it makes me a little sad. The problem always starts the same.
Given a launcher and a target, at what angle must the projectile launch to hit the target? This simple equation, a little algebra, and a few trigonometric identities is all we need. For video games we probably want to know the maximum range of a projectile. AI needs to know how close to move. Players need clear visual indicators showing danger zones.
There is a very simple equation for maximum range on a flat surface. For testing and to provide visualizations I created a Unity demo. It involves teapots shooting teapots. Pew pew! The demo has a handful of sliders. Here we see the range indicator for a teapot turret. As speed goes up range goes up. As gravity goes up range goes down. Pretty simple. Given a projectile with fixed speed S and gravity G at what angle should it be fired to hit a stationary target?
Take a look at the gif above. When the teapot first starts shooting it looks pretty good. The high arc looks nice and pretty.
The low arc feels crisp and efficient. The low arc is almost flat. The high arc is comically high. This is the problem with a fixed speed projectile. It only looks good when the target is at the outskirts of its range. I often prefer to define projectile speed laterally. Only on the ground plane.Physics 3.5.2a - Projectile Motion Concepts
I then explicitly define arc height. Which means vertical velocity and gravity become variable.
Projectile with Air Drag
They care that a turret has a range of 20 meters and projectiles take 1 second to travel that distance. Nor should artistic tweaks affect gameplay mechanics. Steps 3 and 4 is another two equations with two unknowns. So I let a computer solve it for me.The study of the flight of a baseball and the "bend" of a soccer kick are excellent ways for students to learn the basics of forces and the response of an object to external forces. A ball in flight has no engine to produce thrustso the resulting flight is similar to the flight of shell from a cannon, or a bullet from a gun.
This type of flight is called ballistic flight and assumes that weight is the only force acting on the ball. In reality, a baseball or a soccer ball in flight generates a moderate amount of aerodynamic drag and is not strictly ballistic.
On this page we develop the equations which describe the motion of a flying ball including the effects of drag. At launch the ball is inclined at some angle to the vertical, so we resolve the initial velocity into a vertical and horizontal component.
Unlike the ballistic flight equations, the horizontal equation includes the action of aerodynamic drag on the ball. We will first consider the vertical component and then develop the equations for the horizontal component. In the vertical plane, the only forces acting on the ball are the forces of weight and drag.
There is a characteristic velocity which appears in many of the equations that is called the terminal velocity because it is the constant velocity that the object sustains during a coasting descent. Terminal velocity is noted by the symbol Vt. During the vertical descent, for a light object, the weight and drag of an object are equal and opposite. There is no net force acting on the ball and the vertical acceleration is zero. The weight of any object is given by the weight equation :.
The gravitational acceleration has different values on the Moon and on Mars. The drag is given by the drag equation :. On the figure at the top, the density is expressed by the Greek symbol "rho".
The symbol looks like a script "p". This is the standard symbol used by aeronautical engineers. We are using "r" in the text for ease of translation by interpretive software. The gas density has different surface values on the Earth and on Mars and varies with altitude. On the Moon the gas density is zero. Combining the last three equations, we can determine the terminal velocity:. Now, turning to the ascent trajectory, the ball is traveling at an initial vertical velocity Vo.
With the positive vertical coordinate denoted by ythe net vertical force Fnet acting on the ball is given by:. Because the weight of the object is a constant, we can use the simple form of Newton's second law to solve for the vertical acceleration:. Notice that the acceleration changes with time. The limits of integration for velocity v is from Vo to V and the limits for time t is from 0 to t :. Now take the tangent function of both sides of the equation using the trigonometric identity:.
This is the equation for the velocity at any time during the vertical ascent. At the top of the trajectory, the velocity is zero. We can solve the velocity equation to determine the time when this occurs:.
To determine the vertical location during the ascent, we have to use another identity from differential calculus:.John and Philip who live 14 miles apart start at noon to walk toward each other at rates of 3 mph and 4 mph respectively. After how many hours will they meet? He takes a mile trip up the river and returns in 4 hours. Find the rate of the current. Rotate to landscape screen format on a mobile phone or small tablet to use the Mathway widget, a free math problem solver that answers your questions with step-by-step explanations.
We welcome your feedback, comments and questions about this site or page. Please submit your feedback or enquiries via our Feedback page. In these lessons, we will learn how to solve algebra word problems that involve motion. What are Motion or Distance Word Problems? How to solve Motion or Distance Word Problems? Step 1: Draw a diagram to represent the relationship between the distances involved in the problem. Step 3: Use the chart to set up one or more equations.
Step 4: Solve the equations. We will look at three types of Motion Word Problems: 1. Two objects going in opposite directions. Both objects going in the same direction, but one goes further. One object going and returning at different rates. Solve Motion Word Problems: Two objects going in opposite directions Example: John and Philip who live 14 miles apart start at noon to walk toward each other at rates of 3 mph and 4 mph respectively. You can use the free Mathway calculator and problem solver below to practice Algebra or other math topics.
Try the given examples, or type in your own problem and check your answer with the step-by-step explanations.Sign in to comment. Sign in to answer this question. Unable to complete the action because of changes made to the page.
Reload the page to see its updated state. Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:. Select the China site in Chinese or English for best site performance. Other MathWorks country sites are not optimized for visits from your location. Toggle Main Navigation. Search Answers Clear Filters. Answers Support MathWorks. Search Support Clear Filters. Support Answers MathWorks.
Search MathWorks. MathWorks Answers Support. Open Mobile Search. Trial software.
Subscribe to RSS
You are now following this question You will see updates in your activity feed. You may receive emails, depending on your notification preferences.
Numerical approximation of projectile motion with air resistance. Dan on 9 Jul Vote 3. Edited: Nikolaj Maack Bielefeld on 20 Mar Accepted Answer: Teja Muppirala. For a school project, I need to estimate the maximum distance of a projectile without neglecting air resistance.
I'm following the procedure outlined here:. On the second page it shows a nice, step by step process to find a numerical approximation. I am trying to reproduce the trajectory of the baseball that is shown on the last page in order to verify my model. However, the plot shows that the baseball will travel over meters, while my model shows that it will travel about Here is my code:.
Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. In projectile motion, at any time tthe projectile's horizontal x and vertical y displacement are:. You can define a as follows to do the conversion from degrees to radians:. Alternatively, if you don't want to convert your angles to radians, you can use the functions sind and cosdwhich accept their arguments in degrees.
Learn more. Matlab: Projectle motion Ask Question. Asked 2 years, 11 months ago. Active 2 years, 11 months ago. Viewed times. Wolfie Rami Zakia Rami Zakia 11 2 2 bronze badges. Active Oldest Votes. RamiZakia: I don't understand your comment. Did my answer address the problem you're having?
RamiZakia: Well, what have you tried? Have you looked at the help for maxfindor stem? We're here to help you solve specific programming problems you may be having, not write code on demand.
Numerical approximation of projectile motion with air resistance
I tried this one max find x,y then I used stem to determine it but it didn't work Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I am doing a projectile motion where i need to plot curves between position x and y for various angles but the scilab shows only one plot.
I am confused. My code below. You should use vectors to improve compacity and readability of your code. Here is my proposition of improved and working code:. Learn more. Understanding issue in Scilab for my code Ask Question. Asked 2 months ago. Active 2 months ago. Viewed 30 times. Anshul Sharma Anshul Sharma 27 7 7 bronze badges. Are you trying to find the best theta, i. Can you give typical values of m,r,h,c,rho,theta,v0,x0,y0,t0 to test your code?
Also i am not so familiar with the syntax you used so if possible if you can elaborate each step. Active Oldest Votes. I'm thinking if you could further vectorize by using masking, like I did here. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Featured on Meta. Community and Moderator guidelines for escalating issues via new response….
Feedback on Q2 Community Roadmap. Technical site integration observational experiment live on Stack Overflow.