MATLAB: Trend lines

fittinglinear regressionplottingtrend line

Hi, I am trying to plot linear trend lines for a number of data sets and determine their respective gradients. Is there any way of doing this without using the 'tools,basic fitting' tab in the figure? Doing this for every plot will be quite time consuming. Sorry, I know this is probably a pretty basic question, but I'm pretty new to Matlab and would really appreciate any help. Thanks Chloe x

Best Answer

Perhaps polyfit() and polyval()?
doc polyfit
doc polyval