Plot will not graph lines
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I've been trying to figure out why there are no lines being plotted down here. There should be three lines of trajectory.
g = 9.81
vo = 25
y = 3.5
trajectory1 = 30
d1 = vo*cosd(trajectory1)/g*(vo*sind(trajectory1)+sqrt((vo*sind(trajectory1))^2+2*g*y))
x1 = linspace(0,d1,200)
yplot1 = x1.*tand(trajectory1)-(0.5*x1.*x1*g)/((vo.*cosd(trajectory1)).^2)+y
y1 = transpose(yplot1)
trajectory2 = 45
d2 = vo*cosd(trajectory2)/g*(vo*sind(trajectory2)+sqrt((vo*sind(trajectory2))^2+2*g*y))
x2 = linspace(0,d2,200)
yplot2 = x2.*tand(trajectory2)-(0.5*x2.*x2*g)/((vo.*cosd(trajectory2)).^2)+y
y2 = transpose(yplot2)
trajectory3 = 60
d3 = vo*cosd(trajectory3)/g*(vo*sind(trajectory3)+sqrt((vo*sind(trajectory3))^2+2*g*y))
x3 = linspace(0,d3,200)
yplot3 = x3.*tand(trajectory3)-(0.5*x3.*x3*g)/((vo.*cosd(trajectory3)).^2)+y
y3 = transpose(yplot3)
hold on
plot(d1, y1)
plot(d2, y2)
plot(d3, y3)
title('Projecticle Trajectory Graph')
xlabel('Horizontal distance')
ylabel('Vertical distance')
grid on
legend('T1','T2','T3')
hold off
0 commentaires
Réponses (1)
Star Strider
le 5 Oct 2022
The ‘d’ values are all scalars.
Perhaps plooting the ‘y’ values as a function of their associated ‘x’ values —
g = 9.81;
vo = 25;
y = 3.5;
trajectory1 = 30;
d1 = vo*cosd(trajectory1)./g*(vo*sind(trajectory1)+sqrt((vo*sind(trajectory1))^2+2*g*y));
x1 = linspace(0,d1,200)
yplot1 = x1.*tand(trajectory1)-(0.5*x1.*x1*g)/((vo.*cosd(trajectory1)).^2)+y
y1 = transpose(yplot1)
trajectory2 = 45;
d2 = vo*cosd(trajectory2)/g*(vo*sind(trajectory2)+sqrt((vo*sind(trajectory2))^2+2*g*y));
x2 = linspace(0,d2,200)
yplot2 = x2.*tand(trajectory2)-(0.5*x2.*x2*g)/((vo.*cosd(trajectory2)).^2)+y
y2 = transpose(yplot2)
trajectory3 = 60;
d3 = vo*cosd(trajectory3)/g*(vo*sind(trajectory3)+sqrt((vo*sind(trajectory3))^2+2*g*y));
x3 = linspace(0,d3,200)
yplot3 = x3.*tand(trajectory3)-(0.5*x3.*x3*g)/((vo.*cosd(trajectory3)).^2)+y
y3 = transpose(yplot3)
hold on
plot(x1, y1)
plot(x2, y2)
plot(x3, y3)
title('Projecticle Trajectory Graph')
xlabel('Horizontal distance')
ylabel('Vertical distance')
grid on
legend('T1','T2','T3')
hold off
.
0 commentaires
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!