Question: Need it for Matlab 2. [Submit on zyLabs] Write a fiunction that creates a structure that represents a car. It should take the followinz inputs

Need it for Matlab 2. [Submit on zyLabs] Write a fiunction thatNeed it for Matlab

2. [Submit on zyLabs] Write a fiunction that creates a structure that represents a car. It should take the followinz inputs , the mass of he car inkg themumber of passengears the ca car should hold - iElectric, a Boolean variable that indicates mhether the car is electric (true) or not (false) - ue1ORcharge, amber that is either the volume of fuel the car has OR the percent charge the batterv of the car has - orkBernit, the rate at wihich the car's engire conmrts fnel or batery life into forward enarg Your program should then check to see if the car i valid. Inmalid car properties incude: - Values less than 0 for any meric propety - A vale greater than 100 for fuelORcharge ifi Electricis tre Bateries cannot be more than 100% charged If your car is invalid your output car should simply be the stng Invali ca parameters. If your car is talid car should be a structure. Each property of car should have the same name and value as each input variable So, ifyour inputas 300, carawould also be 300. 3. [Submit on zyLabs] Write a fumction that takes a car strucure, as generated from the function you urote in Problem 2, as an input, and retums to mbers as outputs, distance and efficiency. For the purposes of this calculation we ill use the folloning formmla to detemine how far a car can travel at its ideal speed per unit of fuel or charge, mhich is the outputeificiency work per wnit ( mass (kg) efficiency- Where is the constant 60 s. The output distance is the total distance (in meters) that car will travel on a given fuel tank or charge. That is the distance per unit mlriplied by the total mmber of units of fuel or percant electric charge You can use the following test values for your code: mass - 1500 passenger-any electric- either fuelOrCharge 40 workPerUnit 75000 This will produce an efficiancy of 3000 m per unit and a total distance of 120,000 m

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!