Statistics Toolbox | ![]() ![]() |
Add a reference line to the current axes.
Syntax
refline(slope,intercept) refline(slope) h = refline(slope,intercept) refline
Description
refline(slope,intercept)
adds a reference line with the given slope and intercept to the current axes.
refline(slope)
, where slope is a two-element vector, adds the line
y = slope(2) + slope(1)*x
h = refline(slope,intercept)
returns the handle to the line.
refline with no input arguments superimposes the least squares line on each line object in the current figure (except LineStyles
'-'
,'--','.-'
). This behavior is equivalent to lsline
.
Example
y = [3.2 2.6 3.1 3.4 2.4 2.9 3.0 3.3 3.2 2.1 2.6]'; plot(y,'+') refline(0,3)
See Also
lsline
, polyfit
, polyval
, refcurve
![]() | refcurve | regress | ![]() |