Create a MATLAB function called plot that graphically shows if the trip is at all possible.

2 views (last 30 days)
Your friends and you do not own a car, so you plan to rent one. Write a function make_cost which takes two inputs, mpg and rental price, and returns a function handle cost fh. The function handle cost fh takes two inputs, days and distance, and returns the cost of the trip (the rental fee plus the gas expense). In other words, the purpose of the main function is to create a function handle which has the mpg and daily cost of the rental built into it. This function handle can now
be called, within the remaining two inputs (days and total miles), to calculate the entire cost of the trip. Use the gas price of $4.1 per gallon in your codes.
You and your friends decided that it would be awesome to rent a car and drive to
Cancun for Spring Break. Create a MATLAB function called plot that graphically shows if the trip is at all possible.
The problem I am having is with the graph. I have no idea how to plot this.

Answers (1)

Walter Roberson
Walter Roberson on 15 Oct 2012
No time limits? No budget? Everyone has passports? There are enough licensed drivers amongst your friends to drive all the way safely? Is it physically possible to drive between where you are and Cancun (e.g., it isn't possible if you start from Hawaii) ?
If the answers to all of those is positive, then the required graph is independent of anything calculable from the functions you are asked to create in the first paragraph, and the required "plot" function could just text() the string 'Yes' onto the screen.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!