MATLAB Answers

Please help solve and plot the solutions to an equation

1 view (last 30 days)
I have an equation:
D2=(((V2)^2*(sind(2*A2)))/(2*g))*(1+(1+((2*g*H2)/((V2)^2*(sind(A2))^2)))^0.5)
which represents the distance jumped based on height, starting speed, etc etc.
I know the distance jumped D2=11.4m, the height, H2=25.2m, and g=9.81
Assuming A2 can be angles ranging from 0 to 90, I would like to work out possible values of V2(starting speed) matching these angles.
The idea is to plot the values of V2 corresponding to each angle.
Any ideas how I could solve and plot this?
Thank you in advance for the help!

Accepted Answer

Divija Aleti
Divija Aleti on 18 Jan 2021
Hi Alexander,
Have a look at the following code. It shows one of the ways by which you can solve your question.
D2 = 11.4;
H2 = 25.2;
g = 9.81;
A2 = 1:1:89;
V = zeros([89 1]);
syms V2
for i = 1:89
eqn = D2-(((V2)^2*(sind(2*A2(i))))/(2*g))*(1+(1+((2*g*H2)/((V2)^2*(sind(A2(i)))^2)))^0.5)==0;
S = solve(eqn,V2);
if S(1)>=0
V(i) = S(1);
else
V(i) = S(2);
end
end
plot(A2,V)
Output:
For each value of A2, two values of V2 are obtained, out of which I have selected the positive values for plotting. You can also select the negative values.
For additional information on the 'solve' function, refer to the following link :
Regards,
Divija
  1 Comment
Alexander Jacobs
Alexander Jacobs on 26 Jan 2021
Thank you so, so much, Divija. That really helps! Thanks again

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!