MATLAB Answers


Can someone show me how I get the answer surrounded by the phrases in quotes through using the disp and num2str functions?

Asked by Brian
on 4 Mar 2013
The maximum height achieved by an object thrown with a speed v at and angle of (Theta) to the horizontal, neglecting drag is 
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.



No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 4 Mar 2013


[ 'E=mc^', num2str(2) ]


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!