How can i plot the predicted linear model ?

1 view (last 30 days)
Hi, I have trained a linear regression model and plot it using the plot function.
plot(linearmodel)
The problem is that, i also want to plot the response for my test data. As it seems there is not only single linear line. There are couple of lines that is probably used inking each sequential point in the data set( i have learnt this thanks to someone on another platform). How can i reduce it into a single line ?
scatter(coviddataset.sum_Deaths,coviddataset.sum_Deaths); hold on
y=predict(linearModel,coviddataset);
line(coviddataset.sum_Deaths, y,'Color','r')
legend('Training data', 'Linear regression'); hold off
I used the code above and it gives the graph.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!