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

It is my matlab question. I need exactly answer cords. Please help me. As an alt

ID: 3576111 • Letter: I

Question

It is my matlab question. I need exactly answer cords. Please help me. As an alternative, we will now calculate more accurately what the total cost of a car is. Write a function that receives an array of 5 values in this order: [base Price Highway Mpg InTownMpg Highway Miles InTownMiles] Calculate the real cost of ownership by adding the BasePrice to the HighwayMpg HighwayMiles InTownMpg In TownMiles, assuming the same gas price per gallon of $3.00. Return this value. Name the function real cost

Explanation / Answer

%%matlab function that takes a vecotor consists

%of values of array of 5 values and finds the real cost

%of car

function realcost=calculateCost(V)

%get vlaues from array ,V

basePrice=V(1);

HighwayMpg=V(2);

InTownMpg=V(3);

HighwayMiles=V(4);

InTownMiles=V(5);

%calculate real cost

realcost=basePrice+HighwayMpg*HighwayMiles+InTownMpg*InTownMiles;

end

sample output:

--> V=[2 3 4 5 6];
--> cost=calculateCost(V)
cost =
41

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote