How to pick out the details of a specific line in an iterative graph?
Show older comments
Hello,
I wrote this code to plot different paths of a projectile when shot of at the same initial velocity but different angles. Want I'd like to do is mark the path of the of the projectile that goes the farthest. Currently all the lines are blue and I can't tell which one goes the farthest and what angle it was shot from. I've been trying to identify which projectile goes the farthest and what angle it was shot from but I can't figure out how to do that. Any help would be great!
%Projectile motion
%Initial Conditions
v0= 13; % Initial Velocity
a= 0:5:70; % iteration of launch angles
h= 0.02; % Time step
a=a*pi/180;
g=9.8; %acceleration due to gravity in m/s^2
%td=2*v0*sin(a)/g; %total time
x1=0;
y1=0;
figure('color','white');
for t=0:h:3+h
plot(x1,y1,'bo')
hold all
xlim([0 20]);
ylim([0 15]);
title('Projectile Motion');
xlabel('Distance in meter');
ylabel('Height in meter');
getframe;
x1=x1+h*v0*cos(a); %Euler's method for x
y1=y1+h*(v0*sin(a)-g*t);%Euler's method for y
end
Accepted Answer
More Answers (0)
Categories
Find more on Programming 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!