www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ResidualProbabilityPlotExample.m

    %% Normal Probability Plot of Linear Model Residuals
% Create a normal probability plot of the residuals of a fitted linear model.

%%
% Load the |carsmall| data and fit a linear model of the mileage as a
% function of model year, weight, and weight squared. 

%%  
load carsmall
X = [Weight,Model_Year];
mdl = fitlm(X,MPG,...
    'y ~ x2 + x1^2','Categorical',2);  

%% 
% Create a normal probability plot of the residuals of the fitted model. 
plotResiduals(mdl,'probability')