MATLAB: Get the curve parameters in the fit function

curveparfit

How to get the p1 and p2 values after using the fit function. i.e.
[curvepar, fitpar]=fit(rand(100,1), rand(100,1),'poly1')
curvepar =
Linear model Poly1:
curvepar(x) = p1*x + p2
Coefficients (with 95% confidence bounds):
p1 = -0.06171 (-0.2875, 0.1641)
p2 = 0.5492 (0.421, 0.6774)
fitpar =
sse: 9.0309
rsquare: 0.0030
dfe: 98
adjrsquare: -0.0072
rmse: 0.3036
I want the numerical value for p1 and p2? i.e
a=p1; b=p2;
disp(a)

Best Answer

Hi Denise,
follow that command with
p=coeffvalues(curvepar)
The more 'convenient' they make some of these functions, the harder it is to pry information out of them.