Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. (20 points) Create an external function MpsTokmph.m for m/s-to-km/h conversion, that takes an input argument in m/s and outputs a value in km/h. 3.

image text in transcribed
2. (20 points) Create an external function "MpsTokmph.m" for m/s-to-km/h conversion, that takes an input argument in m/s and outputs a value in km/h. 3. Write a script "YourLastName A3 HW 2.m", which: (a) (10 pts) prompts the user to enter a value of the ocean depth in meters and assigns the value to a variable depth using the MATLAB input function. (b) (10 pts) Calculates the speed of a tsunami in meters per second according to the formula Utsunami = Vgd where g = 9.81 m/s2 and d is the depth of the ocean in meters. For your calculation set d = 4000 m. (c) (10 pts) Calculate the tsunami speed in km/h using your external function "Mpstokmph.m", and print the speed in km/h using the disp function. d) (10 pts) Calculate how far, in km, the tsunami will travel in 12 hours. (e) (20 pts) Create an internal function KmToMi, that takes an input value in kilometers, and converts the value to miles and returns that value to the main part of the script. Use it to convert the value obtained in (d) to miles. REMEMBER: internal functions MUST be placed at the end of your script. Your script should print out the speed of the tsunami in km/h and the distance travelled in kilometers and in miles using the fprintf function. There should be 1 digit after the decimal point. Make sure your script is commented (e.g., variable units, what the variable represents if it is not obvious)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions