There is a direct function in MATLAB 'plotResiduals' which will plot the residuals of the model. You can refer to the following documentation for a detailed explanation of the function.
https://www.mathworks.com/help/stats/linearmodel.plotresiduals.html
Hope this helps with your query.