Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 mStep 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