How to display trendline equation on the plot?
Show older comments
Hi
I got the trendline using polyfit() and polyval(). and use plot() to the plot the trendline.
Now my question is how to display the trendline equation onto the plot? Thanks
here are the code for plotting trendline fittedlinecrossplot=polyfit(xdata_crossplot,ydata_crossplot,trendlinepolynomialcoeff); ydata_crossplot_trendline=polyval(fittedlinecrossplot,xdata_crossplot_trendline); hp=plot(hrightsubplot,xdata_crossplot_trendline,ydata_crossplot_trendline,'--g','linewidth',2,'DisplayName',legendlabel_trendline);
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!