Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

matlab: You have just built an electric car and would like to know how many 6v b

ID: 3667781 • Letter: M

Question

matlab:

You have just built an electric car and would like to know how many 6v batterties are needed to drive to work and back so that you only recharge at night. you know that it takes 45 hourse power (hp) to run your electric car but want the option to vary the distance (you may decide to change jobs) write a script that will do the following:

1. Propt for the number of miles to be traveled 1-way (you will want to dowble this value if you plan to get home)- use input(..)

2. Prompt for the expected average speed in miles-per-hour

3. Calculate the energy needed to operate the car for this distance in kilowatt-hours (kWh)

4. Determine the kWh generated by one 6 volt battery

5. Determine the total number of 6 volt batteries needed to operate the car for the kWh determined in 3. above

6. Output the number of 6 volt batteries needed - use fprintf('...')

Helpful information

1. This program is all about the Algebra and kWh! your inputs/knowns are

     ~ miles (distance input),

     ~ miles-per-hour (average speed input),

     ~ kWh (calculated from the given hp and the calculated time to be traveled)

     ~ kWh (known energy capacity that one 6 volt vattery produces)

2. Alkaline 6 Volt batteries are rated at 6v (volts), and varying capacity, depending on the current draw. For this assignment, we will use a capacity of 12.5Ah (Ampere-hours)

3. Power in watts (not kilowats!) is determined by multiplying the voltage by the current, i.e., P=V*I (10v and 2a produces 20w of power)

4. Power may also be represented in horse power (hp): 1hp = 745.7w

5. Dont forget that you need to determine energy in kWh, not just kW

6. When calculating the number of 6 volt batteries, put you calculation within ceil(...) to find the ceiling of the value- rounds to the highest integer - since you cannot have part of a 6 volt battery, only a whole.

Explanation / Answer

1)

2)

%total distance is y. So total time calculate

t = y/s

3) energy = 45*745.7*t/1000

4) kWh_generated = 6*12.5/1000

5) total_batteries = ceil(energy/kWh_generated)

6) fprintf('%d ',total_batteries);