Question
In MATLAB, Write a script file that prompts the user for a row vector, where each element of the vector is a time in seconds
In MATLAB, Write a script file that prompts the user for a row vector, where each element of the vector is a time in seconds (for example, the use will input the row vector [47, 1000, 5000]). The script file should call a user-defined function multiple times (the number of times the function is called should correspond to the number of elements in the vector).
The user-defined function should accept a single scalar input, time (in seconds); covert that timeinto the equivalent time (in hours, minutes and seconds), and output the hours, minutes, andseconds.
Using the script file, present the outputs from the function to the command window in the formathh:mm:ss. For example, the time 1000 s should be displayed as: Your input, 1000(s), is equivalent to 0:16:40 (hh:mm:ss)
1. Write a script filethat prompts the user for a row vector, where each element of the vector is a time in seconds (for example, the use will input the row tor [47, 1000, 5000). The script file should call a user-defined function multiple times (the number of times the function is called should correspond to the number of elements in the vector. The user-defined function should accept a single scalar input, time (in seconds); covert that time into the equivalent time (in hours, minutes and seconds), and output the hours, minutes, and seconds. Using the script file, present the outputs from the function to the command window in the format hh:mm:ss. For example, the time 1000 s should be displayed as: Your input 1000 (s), is equivalent to 0:16:40 (hh: mm: ss)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started