To plot the adjusted R-squared and the sum of squared error in MATLAB, you first need to calculate these values using your data. Once you have the calculated values, you can use the plot function in MATLAB to create the plot.
Here is an example of how you can do this:
main.m396 chars23 lines
In this example, we first generate some example data (x
and y
) and fit a linear regression model to it using the fitlm
function. We then calculate the adjusted R-squared and the sum of squared error using the Rsquared.Adjusted
property and the Residuals.Raw
property of the model
object, respectively. Finally, we create a figure with two subplots using the subplot
function and plot the adjusted R-squared and the sum of squared error using the plot
function.
Note that this example assumes you have already fitted a regression model to your data using the fitlm
function. If you have a different model or want to plot different statistics, you may need to adapt the code accordingly.
gistlibby LogSnag