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);
Best Answer