Can someone show me how I get the answer surrounded by the phrases in quotes through using the disp and num2str functions?
1 次查看(过去 30 天)
显示 更早的评论
The maximum height achieved by an object thrown with a speed v at and angle of (Theta) to the horizontal, neglecting drag is
h=((v^(2))*((sin^2)*(theta))/2*g
use g=9.81m/s^2 and create a script file that lets the use enter a value of V(in m/s) and a value of theta(in degrees), and computes the maximum height h.
Use the input function twice to prompt the user to enter values for v and theta. The first prompt should say "Please enter a value of the initial velocity in m/s and then press enter". The second prompt should say "Please enter a value of the launch angle in degrees, then press enter".
Use the disp function and the num2str function to display the numerical value of the height h with the text " The maximum height is:" followed by the value of of the launch angle in degrees, followed by the text "meters."
Use the script file to compute the maximum height when v=18m/s and theta=70 degrees.
I understand how to do the problem up until the point where I have to use disp and num2str functions.
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!