Introduction to Surface Fitting

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video demonstrates surface fitting in MATLAB using the SF tool graphical user interface surface fitting is a technique in which we model a dependent variable as a function of two independent variables a typical example from engineering might involve modeling fuel consumption for an automobile engine here I'm going to select brake specific fuel consumption as my dependent variable or Z variable engine speed and load R my independent variables alternatively professionals working in financial services often need to work with implied volatility surfaces the implied volatility and the value of an option can be modeled as a function of the strike price for that option and the time to maturity which yields of the classic volatility smile the drop-down menu at the top of SF tool controls what type of surface fitting algorithm you'll be using let's start by looking at regression linear regression is supported using the polynomial drop-down the most common use case is adding a reference plane to a data set however you can also create polynomial surfaces of up to degree 5 the custom equation window allows you to specify your own surface fitting equations for non linear regression whatever you type in the custom equation window is fed directly into MATLAB for processing you can either enter an equation directly into the window or call matlab functions by name the ability to call matlab functions by name is very useful power users can create sophisticated fitting models save these as matlab functions and share these files across their organization new users can then reference those models by entering the name of the function into the custom equation window when we perform a regression analysis we start by specifying some model that we believe best describes our data the model is normally derived using our knowledge regarding the laws of physics how chemical pathways operate and the like unfortunately all too often we have no idea what type of model to specify in some cases visual inspection of the data will provide some clues however there are examples like the one we're looking at here where visual inspection just doesn't help even after adding a reference plane I don't have any idea what type of model to use this is when techniques like Louis are used Louis is a nonparametric fitting method as long as you have a nice dense cluster of data points Louis will generate a decent fit the spanning parameter is used to control how sensitive the lowest surface is to the data set the lower the spanning value the more responsive the surface is to both the data and to the noise the last fitting method that I want to discuss is interpolation the interpolant option in the fitting drop-down window provides an alternative interface to the standard interpret that lab if you select interpolant you create a surface that will pass through each and every point in your data set interpolation provides an easy way to visualize a smooth surface however this technique doesn't work nearly as well with noisy data the resulting surface will be very spiky it's almost impossible to get much intuition from the resulting plot once you've created your fit you have a variety of options to analyze the results visual inspection is a very powerful way to judge the quality of a fit surface fitting tool uses standard MATLAB methods to create and display images and provides the same rotate and view options in many cases residual plots are used to evaluate goodness-of-fit if you find obvious patterns within the residuals this can be a sign that your model fails to capture important interactions between your variables alternatively if the residuals appear random this makes your model more credible goodness-of-fit measures such as r-squared adjusted r-squared and the sum of the squared errors provide simple summary statistics to evaluate your model these summary statistics can be viewed using either the results window or the table fits you often need to compare and contrast different techniques for generating a surface for example you might want to compare a linear regression model generated using a high order polynomial with a nonlinear regression model generated from a custom equation I'm gonna start by changing this fit to a fifth order polynomial next I use the duplicate fit option in the fit drop-down menu to create a copy of the polynomial finally I change the fit type of this new model from polynomial to custom equation notice that the table fits now contains two different fits we can use the goodness of fit information contained within the table to conveniently compare the two competing models the last topic that I want to show is code generation code generation is often used for batch processing you can perform an analysis once using the SF tool GUI and then replicate that analysis with a MATLAB function alternatively many users like to start a project in the GUI but then customize their analysis in MATLAB code generation is extremely simple once you complete your analysis click on the generate M file option and you'll be moved directly into MATLAB SF tool automatically creates an M file inside of the MATLAB desktop the resulting M code is extremely easy to read and this code is actually a great way to learn MATLAB coding you can also pass new variables into the function and use this to replicate your analysis here on passing new variables into my create surface fit function and now by executing that function I've been able to replicate my complete analysis this concludes our video introduction to surface fitting with MATLAB thank you
Info
Channel: MATLAB
Views: 12,202
Rating: 4.9148936 out of 5
Keywords: Curve Fitting Toolbox, Fitting, Introduction, Surface, mathworks, matlab
Id: SGgqRbd_A1Q
Channel Id: undefined
Length: 7min 24sec (444 seconds)
Published: Thu Apr 18 2013
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.