Finding the trajectory of a projectile

57 visualizzazioni (ultimi 30 giorni)
Hello,
I'm new to matlab and i'm struggling very much with it.
I have been assigned a coursework in which i must find the trajectory of a projectile.
The coursework looks like this:
The path of a projectile is an interesting, important, and sometimes challenging problem. It’s very likely that you will have studied the path of a projectile in the absence of atmospheric drag in basic mechanics, since this can be derived analytically. In the real world, however, drag can significantly alter the trajectory. Unfortunately, in introducing this effect, we lose the ability to analytically obtain solutions for the projectile’s trajectory: simulating the trajectory is therefore required. In this assignment, you will therefore write a Matlab program that computes trajectories under the influence of drag, and use this to solve a simple targeting problem.
We will neglect any crosswind effects, so that the projectile travels in a two-dimensional plane with coordinates (x, y). The projectile’s position, velocity and acceleration can therefore be represented as vector functions of time, which we denote by r(t) = [rx(t), ry(t)], v(t) = [vx(t), vy(t)] and a(t) respectively. As the projectile travels through space, we will assume that it experiences two forces: acceleration due to gravity, and a drag force Fd acting in the direction opposite to its trajectory. A free body diagram of this scenario can be found in Figure 1. The drag force can be roughly approximated by the drag coefficient Cd through the relationship : Fd = 1/2 (ρ*Cd*A*|v|*v)
which also involves the velocity v, air density ρ and the frontal area A (i.e. the two-dimensional cross-section exposed to the drag force). cd is dimensionless and is used to quantify the drag of an object in a fluid: the lower the value, the lower the drag force. To simulate the trajectory of the projectile, we can use Newton’s second law: F = ma ⇒ a(t) = (1/m)*(((− 1/2)* ρcdA|v|v) − mg ). where m is the mass of the projectile and g = (0, g) is acceleration due to gravity with g = 9.81 ms−2 . Since we are interested in the projectile’s trajectory r, we can then utilise the fact that a(t) = dv/dt = v'(t) and v(t) = dr/dt = r'(t) , which gives a ordinary differential equation r''(t) = (1/m)*(((− 1/2)* ρcdA|r'|r') − mg ). equation (1)!
All that is left to do is equip the above with an appropriate set of initial conditions at time t = 0: we will imagine that the projectile is fired from an initial starting height h at an angle of θ degrees and initial speed (velocity magnitude) v0, which gives: r(0) = (0, h) and r˙(0) = v(0) = [v0 cos(θ), v0 sin(θ)]
can someone please help me with it as im totally lost on how to implement this into matlab language?
  4 Commenti
Image Analyst
Image Analyst il 21 Gen 2021
Looks like a duplicate of your other question where I asked you what was t and y.
Nicolae Lungu
Nicolae Lungu il 21 Gen 2021
Because basically they both are functions im tryng to implement for the assignment above, but i can't understand where im doing wrong and how to fix them.....

Accedi per commentare.

Risposta accettata

Image Analyst
Image Analyst il 20 Gen 2021
Attached is a program my son and I did for his college physics course. It computes just about everything you could possibly want to know about a projectile, with all kinds of parameters (starting angle, height, velocity, etc.) and graphs. Adapt as needed.
  3 Commenti
Joseph Durocher
Joseph Durocher il 17 Nov 2022
Is there a way to change the calculation to add drag force?
Image Analyst
Image Analyst il 17 Nov 2022
Probably. Use whatever formula you have. I don't have one. Feel free to adapt the code to your own needs.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by