Main Content


Class: NonLinearModel

Plot of slices through fitted nonlinear regression surface


h = plotSlice(mdl)


plotSlice(mdl) creates a new figure containing a series of plots, each representing a slice through the regression surface predicted by mdl. For each plot, the surface slice is shown as a function of a single predictor variable, with the other predictor variables held constant.

h = plotSlice(mdl) returns handles to the lines in the plot.

Input Arguments


Nonlinear regression model, constructed by fitnlm.

Output Arguments


Vector of handles to lines or patches in the plot.


expand all

Plot slices of a fitted nonlinear model.

Load the reaction data and fit a model of the reaction rate as a function of reactants.

load reaction
mdl = fitnlm(reactants,rate,@hougen,[1 .05 .02 .1 2]);

Create a slice plot.


Figure Prediction Slice Plots contains 3 axes and other objects of type uimenu, uicontrol. Axes 1 contains 5 objects of type line. Axes 2 contains 5 objects of type line. Axes 3 contains 5 objects of type line.

Drag the X1 prediction line to the right, and observe the change in the predicted response y and in the predicted response curves to X2 and X3.


  • If there are more than eight predictors, plotSlice selects the first five for plotting. Use the Predictors menu to control which predictors are plotted.

  • The Bounds menu lets you choose between simultaneous or non-simultaneous bounds, and between bounds on the function or bounds on a new observation.