Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This prompt is to be done using Matlab. I just need some guidance on how to go about this. Mini Project #2 Bus Routes. Introduction

This prompt is to be done using Matlab. I just need some guidance on how to go about this.

Mini Project #2 Bus Routes.

Introduction You are working for a city, and want to set up a system for understanding the needs of the buses running on certain routes. Using demographic data technical specifications of the busses, the city has created data structures for each city bus with the following propertiesthat do not change:

bus.mass The mass of the buss bus.passMass The average mass of a passenger on a route. bus.engine The amount of force the bus's engine puts outper unit mass

In addition. you have added the following property to the structure for simulation purposes. This propertycan change:bus.numpass - The number of passenger on the bus.

Procedure The city wants you to do some calculations on the amount of work of buses have to on bus routes, given the number of passengers entering and leaving buses. You will write a function called busSim take the following inputs:

bus A structure with the format defined above. You can assume that it will start with a certain number of passengers on board. passOn An array that contains only integers. This is the number of passengers that get on each stop. passOff An array that contains only integers and is the same length as passOn. This is the number of passengers that get off at each stop. distance An array that contains only real numbers and is the same length as passOn containing the distance the bus has to travel after each bus stop to get to the next stop.

It should return the following outputs:

bus An updated version of the input structure with the final numbers of passengers. passRecord An array with the as passOn with the number of the passenger after each bus stop. totalWork A real number that is thetotal amountof work the bus's engine has had to put out on the entire trip. You can assume passengers will board and leave the bus at the first stop.

It should return the following outputs:

bus - An updated version of the input structure with the final number of passengers. passRecord - An array with the same length as passOn with the number of passengers after each bus stop. totaIWork A real number that is thetotal amountof work the bus's engine has had to put on the entire trip. You can assume that passengers will board and leave the bus at the first stopbeforeyou have to make the first work calculation. You should therefore makeas many work calculations as there are elements in each of the input arrays.

Additional Code Data Entry Errors Your function should work with any inputs that are of the correct input data types, even if they contain errors. You should handle those errors in the following ways:

- If your input arrays arenot all the same lengthyou should only do calculationsup to the index of the shortest array. - If the number of passengers would ever go below 0.it should instead be set to 0. - If the number of passengers would ever be a non-negative value,it should instead be rounded up to the nearest integer. - If a distance is listed as negative, treat it as positive.

You can assume the following and do not have to check for them:

- Masses will always be positive. - Engines will always put out positive force. - The numbers in passOn or passOff will always be non-negative.

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

Step: 3

blur-text-image

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions