How to label the farthest x point

1 visualizzazione (ultimi 30 giorni)
NEIL Alfred
NEIL Alfred il 25 Gen 2022
Risposto: Star Strider il 25 Gen 2022
v0=75;%initial velocity of 75m/s
g=9.81;%force of gravity 9.81 m/s^2
theta=[0:(pi/100):(pi/2)]; %values between constraints
temp1=sin(2*theta);%formula for Range given
temp2=(v0^2)/g;
Range=temp2.*temp1;
plot(Range,theta)
title('Maximum Projectile Range');
xlabel('Range(m)');
ylabel('Theta(angle)');
grid on;
This is the code and i need to label the maxiumum x value without using ginput.

Risposte (1)

Star Strider
Star Strider il 25 Gen 2022
Consider perhaps ...
v0=75;%initial velocity of 75m/s
g=9.81;%force of gravity 9.81 m/s^2
theta=[0:(pi/100):(pi/2)]; %values between constraints
temp1=sin(2*theta);%formula for Range given
temp2=(v0^2)/g;
Range=temp2.*temp1;
plot(Range,theta)
title('Maximum Projectile Range');
xlabel('Range(m)');
ylabel('Theta(angle)');
grid on;
[Rmax,idx] = max(Range);
text(Rmax, theta(idx), sprintf('Farthest ‘x’ Point \\rightarrow '), 'Horiz','right', 'Vert','middle')
.

Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by