Question: Write a MATLAB script that will generate a matrix with daily values of time between 0 and 240 minutes corresponding to parking times for

Write a MATLAB script that will generate a matrix with daily values

of time between 0 and 240 minutes corresponding to parking times forup to 10 vehicles for 5 days a week and calculates the

Write a MATLAB script that will generate a matrix with daily values of time between 0 and 240 minutes corresponding to parking times for up to 10 vehicles for 5 days a week and calculates the daily parking amount to pay and the amount to pay for the week. The program will convert the minutes to whole hours and calculate the cost with an hourly parking fee of $1.50. Steps to generate the matrix with values from 0 to 240: a. Prompt the user to input the number of vehicles that used the parking lot. It must be an integer up to 10. If n is not an integer* or within the range, the script must give an error message and prompt the user to input the number of vehicles again. b. Use rand(n,5) to create an nx5 matrix. The function rand(n,m) generates an nxm matrix with elements ranging in value from 0 to 1. c. Multiply the previous matrix by 240 to obtain values from 0 to 240. The script must output the matrices obtained in steps (b) and (c), the matrix containing the corresponding number of hours, the matrix containing the daily parking cost and a summary of the amount paid for the week as follows. The following is an example of the outputs for 3 vehicles: Matrix containing random values from 0 to 1: 0.0540 0.9340 0.4694 0.5308 0.1299 0.0119 0.7792 0.5688 0.3371 0.1622 0.7943 0.3112 0.5285 0.1656 0.6020 Matrix containing parking time in minutes: 12.9480 224.1626 112.6538 127.3914 31.1775 2.8565 187.0001 136.5177 80.9094 Matrix containing parking time in whole hours: 4 1 3 134 212 38.9238 126.8480 190.6283 39.7557 74.6916 144.4757 3 1 2 2 3 142 Matrix containing daily parking fees: Weekly report: 1.5000 4.5000 6.0000 6.0000 1.5000 4.5000 3.0000 1.5000 3.0000 1.5000 6.0000 3.0000 Vehicle 1 pays $16.50 this week Vehicle 2 pays $15.00 this week Vehicle 3 pays $21.00 this week 4.5000 1.5000 4.5000

Step by Step Solution

3.46 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The required MATLAB script to perform necessary ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mechanical Engineering Questions!