How do I get a plot of a parabola graph from the mathematical model(trajectory of a particle) given?
3 views (last 30 days)
Show older comments
Hi.
I am having a bit of a problem getting the graph of this mathematical model. The graph that I am supposed to get is a parabola showing the trajectory of a particle with drag.(I do get a parabola for the trajectory of the particle without drag.) Instead I keep getting half of a parabola.
I have tried changing the parameters but I still can't seem to get the parabola. The v(velocity),theta(launch angle),r(radius of particle) and x0(initial position) can be changed below.
I would really like some help here.
The equation of the trajectory of the particle with drag is:
x(t) = v_∞ t + m/k (v_0 – v_∞ )(1 - e ^(-kt/m)) + x_0.
The codes for the model that I have written is:
clc; close all; clear all;
% Flight trajectory computation
% Initial values
g = 9.81; % gravity, m/s^2
v = 40; % launch velocity, m/s
theta = 55 * pi/180; % launch angle, radians
m = 5.5*10^-7;
u = 1.78*10^-5;
r = 0.001;
k = 6*pi*u*r;
vinf = m*g/k;
x0 = 20;
% Compute and display results
disp('time of flight (s):') % label for time of flight
tg = 2 * v * sin(theta)/g % time to return to ground, s
disp('distance traveled (ft):') % label for distance
xg = v * cos(theta) * tg % distance traveled
% Compute and plot flight trajectory
t = linspace(0,tg,5000);
x = v * cos(theta) * t;
%y = v * sin(theta) * t - g/2 * t.^2; %trajectory of a particle without drag
y = vinf * sin(theta) * t - m/k * (v * sin(theta) - vinf* sin(theta) * (g/2 * t^2))*(1 - exp(-(k*t)/m)) + x0; %trajectory of a particle with drag
plot(x,y) , axis equal, axis([ 0 300 0 100 ])
0 Comments
Answers (0)
See Also
Categories
Find more on Polygons in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!