MATLAB: How to perform curve / surface fitting for data of more than three dimensions

4dlsqcurvefitMATLABn-dimensionalregressregression

The Curve Fitting Toolbox works with data of two or three dimensions. How can I perform similar tasks on data of more than three dimensions?

Best Answer

There are three options for performing curve-fitting tasks on data of more than three dimensions:
You can use MATLAB's backslash operator to do linear regression on multidimensional data.  Please refer to the following link for documentation on the backslash operator:
If it is expected that there is a linear relationship between the variables, the `regress` function in the Statistics and Machine Learning Toolbox can be used to calculate coefficients for a linear curve. Please refer to the following link for documentation on 'regress':
A more general tool for curve fitting N-dimensional data is the 'lsqcurvefit' function in the Optimization Toolbox, which solves nonlinear curve-fitting problems in least-squares sense. Using  'lsqcurvefit' requires creating a function representing the expected relationship which has parameters that can be adjusted to fit the data. 'lsqcurvefit' determines the optimal values for those parameters so that the function fits the data. Please refer to the following link for documentation on 'lsqcurvefit':