Please help solve and plot the solutions to an equation

조회 수: 2 (최근 30일)
Alexander Jacobs
Alexander Jacobs 2021년 1월 14일
댓글: Alexander Jacobs 2021년 1월 26일
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!

채택된 답변

Divija Aleti
Divija Aleti 2021년 1월 18일
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
Alexander Jacobs
Alexander Jacobs 2021년 1월 26일
Thank you so, so much, Divija. That really helps! Thanks again

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by