# Use Matlab to Fit Smooth Surfaces To Investigate Fuel Efficiency sdClone

This example shows how to use Curve Fitting Toolbox to fit a response surface to some automotive data to investigate fuel efficiency. The toolbox provides sample data generated from a GTPOWER predictive combustion engine model. The model emulates a naturally aspirated spark-ignition, 2-liter, inline 4-cylinder engine. You can fit smooth lowess surfaces to this data to find minimum fuel consumption.

The data set includes the required variables to model response surfaces:

- Speed is in revolutions per minute (rpm) units.
- Load is the normalized cylinder air mass (the ratio of cylinder aircharge to maximum naturally aspirated cylinder aircharge at standard temperature and pressure).
- BSFC is the brake-specific fuel consumption in g/KWh. That is, the energy flow in, divided by mechanical power out (fuel efficiency).

The aim is to model a response surface to find the minimum BSFC as a function of speed and load. You can use this surface as a table, included as part of a hybrid vehicle optimization algorithm combining the use of a motor and your engine. To operate the engine as fuel efficiently as possible, the table must operate the engine near the bottom of the BSFC bowl.

## Model File Tree

## Software Used

### Matlab

**MATLAB** (**mat**rix **lab**oratory) is a multi-paradigm programming numerical computing environment and fourth-generation programming language. A proprietary programming language developed by MathWorks, MATLAB allows matrix manipulations, plotting of function and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C , C++, C Sharp, Java, Fortran and Python.

For more details see Matlab .

## Results

We process the measured data and then fit a surface to the processed data. Here is the fit a surface of fuel efficiency to the **preprocessed** data.

On review the resulting plot, we see that there are points where BSFC is negative because this data is generated by an engine simulation. Lets remove those problem data points by keeping points in the range [0, Inf]. Lets fit a new surface by not including the problem points. New fit in plotted in Fig2. Note that the excluded points are plotted as red crosses.

Lets zoom in on the part of the z-axis of interest. You want to operate the engine efficiently, so lets create a contour plot to see the region where the BSFC is low. The contour plot is shown in Fig 3.

Now we generate a table of predictions, by evaluating the model fit over a grid of points. Then, lets plot the table against the original model (Fig. 4). The grid on the model surface shows the table breakpoints.

Lets view the difference between the model and the table by plotting the difference between them on a finer grid. Then, use this difference in prediction accuracy between the table and the model to determine the most efficient table size for your accuracy requirements.

## Related Models

Following are some related models available for cloning/copying by anyone:

- Matlab Surface Fitting With Custom Equations to Biopharmaceutical Data
- Matlab Surface Fitting With Custom Equations to Biopharmaceutical Data (876)
- Matlab curve fitting example
- Matlab curve fitting example (4)
- Matlab curve fitting example - Copy
- Matlab surface fitting example
- Matlab surface fitting example using cftool GUI
- Matlab surface fitting example using cftool GUI (67)
- Near field 3D spatial optical field profiles inside a layer of amorphous silicon with nano-holes backed with a metal reflector

Click on the category links at the bottom of this page to navigate to a full list of simulation models in similar subject area or similar computational methodology.