Search for question
Question

SPR 2022 EGR 150

Homework A3_HW

Due: Sept. 8th, 2023

Write a script named "YourLastNameA3_HW_1.m" which:

1. (10 pts) Prompts the user to enter a depth in meters and assigns the value to a

variable depth using the MATLAB input function.

2. (10 pts) Calculates the speed of a tsunami in meters per second according to the

formula

=√gd

where g = 9.81 m/s²and d = 1400 is the depth of the ocean in meters and assigns the

result to the variable velTsunami.

tsunami

3. (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.

4. (a) (10 pts) Calculate the wave speed of the tsunami in km/h using your external

function "MpsTokmph.m", and print the speed in km/h using the disp function.

(b) (10 pts) Calculate how far, in km, the wave will travel in 12 hours.

5. include housekeeping commands clear and clc.

6. include comments.

7. have only one command per line.

8. makes sure the output is suppressed except when the disp function is used.

Fig: 1