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

MATLAB Write a function that takes no arguments and returns 2 variables, mpg and

ID: 3741619 • Letter: M

Question

MATLAB Write a function that takes no arguments and returns 2 variables, mpg and car_model.
The function will read the file ‘porsche.xlsx’ and will get ONLY the miles per gallon data (mpg) and the car line data (car_model).
Find the car(s) with miles per gallon greater than 32.
Create a new MS Excel file, ‘mpg322007’ with the selected data.
If you have Matlab version 2016b, you can write the function on the same script as the main program and submit only one M-file. Lab_08_yourName.

Year MfrName CarLine Car_Truck EngDisp Police RatedHP Transmission Drive Weight Comp AxleRatio EVSpeedRatio AC PRP FuelType City_Highway 2007 PORSCHE CAYMAN car 164 N 245 L5 R 3375 11.1 4.38 42.7 N 1 61 highway 2007 PORSCHE CAYMAN S car 207 N 295 L5 R 3500 11.1 4.16 40.5 N 1 61 highway 2007 PORSCHE CARRERA 2 COUPE car 220 N 325 L5 R 3625 11.3 3.56 41.4 N 1 61 highway 2007 PORSCHE CARRERA 2 S COUPE car 232 N 355 L5 R 3625 11.3 3.56 39.4 N 1 61 highway 2007 PORSCHE CARRERA 2 CABRIOLET car 220 N 325 M6 R 3625 11.3 3.44 40.2 N 1 61 highway 2007 PORSCHE CARRERA 4 CABRIOLET car 220 N 325 M6 4 3750 11.3 3.44 40.2 N 1 61 highway 2007 PORSCHE CARRERA 4 COUPE car 220 N 325 L5 4 3750 11.3 3.56 41.4 N 1 61 highway 2007 PORSCHE CARRERA 2 S CABRIOLET car 232 N 355 L5 R 3750 11.3 3.56 39.4 N 1 61 highway 2007 PORSCHE TURBO   4 911 TURBO car 220 N 480 L5 4 3875 9 3.82 35.9 N 1 61 highway 2007 PORSCHE CARRERA 4 S CABRIOLET car 232 N 355 L5 4 3875 11.3 3.56 39.4 N 1 61 highway 2007 PORSCHE CARRERA 4 S CABRIOLET car 232 N 355 M6 4 3750 11.3 3.44 39.7 N 1 61 highway 2007 PORSCHE GT3       911 GT3 car 220 N 415 M6 R 3500 12.1 3.44 41.7 N 1 61 highway

Explanation / Answer

SAVE THE FOLLOWING CODE IN MATLAB AND GET THE RESUTLS-

clc

clear

close all;

values={37, 29, 40 ; 34, 25, 'x' ; 47, 38, 79};

Car_Truck={'C1','C2','C3'};

xlswrite('myExample.xlsx',[Car_Truck; values]);

filename = 'myExample.xlsx';

A=xlsread(filename);

B=A>32;

disp('The cars with miles greater than 32 are')

disp(5)