- #1
cwrn
- 15
- 0
I'm working on a little project where I want to plot the motion of a projectile with air resistance. The air resistance can be assumed to be proportional to the velocity squared.
[itex]F_{f}=-Bv^{2}[/itex]
[itex]F_{f,x}=F_{f}\frac{v_{x}}{v}, \ \ F_{f,y}=F_{f}\frac{v_{y}}{v}[/itex]
where B depends on the height, y above the ground
[itex]B(y) = B_{0}e^{-y/y_{0}}[/itex]
Given
[itex]k = \frac{B_{0}}{m}=4\cdot 10^{-5} \ m^{-1}, \ y_{0} = 1\cdot 10^4 \ m, \ v_{0} = 700 \ m/s[/itex]
I have derived the equations of motion as following:
[itex]\vec{r}=\left(v_{0}tcos\theta-\frac{1}{2}kvv_{x}e^{-y/y_{0}}\cdot t^2\right)\hat{i}+\left(v_{0}tcos\theta+\frac{1}{2}\left[\vec{g}-kvv_{y}e^{-y/y_{0}}\right] t^2\right)\hat{j}[/itex]
[itex]\vec{v}=\left(v_{0}cos\theta-kvv_{x}e^{-y/y_{0}}\cdot t\right)\hat{i}+\left(v_{0}sin\theta+\left [\vec{g}-kvv_{y}e^{-y/y_{0}}\right]t\right)\hat{j}[/itex]
[itex]\vec{a}=\left(-kvv_{x}e^{-y/y_{0}}\right)\hat{i}+\left(\vec{g}-kvv_{y}e^{-y/y_{0}}\right)\hat{j}[/itex]
I'm having trouble defining a function I can use with ode45 since there are several variables depending on each other (assuming my equations are correct). Any tips would be greatly appreciated.
[itex]F_{f}=-Bv^{2}[/itex]
[itex]F_{f,x}=F_{f}\frac{v_{x}}{v}, \ \ F_{f,y}=F_{f}\frac{v_{y}}{v}[/itex]
where B depends on the height, y above the ground
[itex]B(y) = B_{0}e^{-y/y_{0}}[/itex]
Given
[itex]k = \frac{B_{0}}{m}=4\cdot 10^{-5} \ m^{-1}, \ y_{0} = 1\cdot 10^4 \ m, \ v_{0} = 700 \ m/s[/itex]
I have derived the equations of motion as following:
[itex]\vec{r}=\left(v_{0}tcos\theta-\frac{1}{2}kvv_{x}e^{-y/y_{0}}\cdot t^2\right)\hat{i}+\left(v_{0}tcos\theta+\frac{1}{2}\left[\vec{g}-kvv_{y}e^{-y/y_{0}}\right] t^2\right)\hat{j}[/itex]
[itex]\vec{v}=\left(v_{0}cos\theta-kvv_{x}e^{-y/y_{0}}\cdot t\right)\hat{i}+\left(v_{0}sin\theta+\left [\vec{g}-kvv_{y}e^{-y/y_{0}}\right]t\right)\hat{j}[/itex]
[itex]\vec{a}=\left(-kvv_{x}e^{-y/y_{0}}\right)\hat{i}+\left(\vec{g}-kvv_{y}e^{-y/y_{0}}\right)\hat{j}[/itex]
I'm having trouble defining a function I can use with ode45 since there are several variables depending on each other (assuming my equations are correct). Any tips would be greatly appreciated.
Last edited: