Please help solve and plot the solutions to an equation
2 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!