In recent years, the price of gasoline has increased dramatically. Automobile co
ID: 3925695 • Letter: I
Question
In recent years, the price of gasoline has increased dramatically. Automobile companies have responded with more fuel-efficient cars, in particular, hybrid models. But will you save money by purchasing a hybrid such as the Toyota Camry rather than a Camry with a standard engine? They hybrid vehicles are considerably more expensive, but get better gas mileage. Consder the prices and gas efficiencies show in the table.
2013
2013
One way to compare two vehicles is to fin the "cost to own"
Cost to own=purchase cost+upkeep+gasoline cost
Assume upkeep costs are equal to zero
A) what do you think the cost of gasoline will be over the next several years? Prompt the user to enter an estimate of gasoline cost in dollars/gallon
B)Find the "cost to own" as a function of the number of miles driven for a pair of vehicles from the table, based on the fuel price estimate from part (a). Plot your results on an x-y graph. The point where the two lines cross is the break-even point.
C) use the ginput function to pick the break even point off of the graph
D) use sprintf to create a string identifying the break-even point, and use the result to create a text-box annotation on your graph. Postion the text box using the gtext function
Year Model Base Msrp Gass Efficiency, in-town/highway(mpg)2013
Toyota Camry LE $22680 25/35 2013 Toyota Camry Hybrid LE $26140 43/39 2013 Toyota Highlander $29020 20/25 2013 Toyota Highlander 4WD Hybrid $42170 28/282013
Ford Fusion 2WD $21900 22/34 2013 Ford Fusion SE Hybrid $27200 47/47Explanation / Answer
Answer:
Mat lab code:
%Reads the estimated gasoline cost
userGasolineCostValue = input('Enter future estimated gasoline Cost: ')
%declares the value of t1
t1 = 18000:1000:26000
%calculating the gasoline value for sample camry
y1 = userGasolineCostValue+18720
%calculating Gasoline for camro hybrid
y2 = userGasolineCostValue+25350
%use of the ginput function
[xout,yout] = ginput(2);
%Plotting the calculated value in graph
plot(t1,y1,'linewidth',2)
%calculates the limits
set(gca,'xlim',[min(t1) max(t1)],'ylim',[-1.1 1.1])
hold on
%plotting the another value
plot(t1,y2,'g','linewidth',2)
%plotting the markersize
plot(xout,yout,'r.','markersize',18)
%prints the result
result = sprintf('%d %d',xout,yout)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.