error calculation perfect fit

1 view (last 30 days)
sarah
sarah on 30 May 2015
Commented: Star Strider on 3 Jun 2015
Hi guys, so I have experimental data in column matrix y. And I want to use the equation below to find x as a function of y. This means have constant b adjusted from 0 to 2 and hence want to obtain the ideal b value.
I'm thinking of using a double for loop however would anyone know how to calculate for error and set a desirable tolerance. Or tips on how to solve for it effectively?
Thanks in advance. The equation is:
y= (1-0.05*x^(b))/(1-0.03*x^b)^2

Accepted Answer

Star Strider
Star Strider on 30 May 2015
I would use nlinfit and nlparci to estimate ‘b’, and use a few values of ‘x’ and ‘y’ to provide an initial estimate, with:
b = log(20*(1-1./y))./log(x);
Noting the assumptions and restrictions that I mentioned earlier.
  25 Comments
sarah
sarah on 3 Jun 2015
Edited: sarah on 3 Jun 2015
Sure.
Also i wanted to ask you regarding residuals. Residuals for some selective data is very small e-8 and the system solves. However for say the whole range i.e. 70 data points the fit isn't good i.e. residuals are large 1000. However my b(1) and b(2) are satisfactory. It doesn't mean my model is wrong right i.e. my coding. I'm assuming that experimental data at certain range is wrong.
Star Strider
Star Strider on 3 Jun 2015
It’s difficult to determine the reasons the residuals are very low in one region and high in another. My guess is that either (1) your model does not completely describe the process that created your data, or (2) some regions simply have more noise than others. This may not be a problem if your parameter estimates are acceptable and your model provides a good fit in your area of interest.

Sign in to comment.

More Answers (1)

John D'Errico
John D'Errico on 30 May 2015
How many points do you have that you expect a perfect fit? (Hint: with only one parameter to solve for, only ONE point will give you a perfect fit in general. With more points than that, you won't get a perfect fit.)
Anyway, with the model you have chosen, is there some good reason why you choose to define it as
y= (1-0.05*x^(b))/(1-0.05*x^b)^2
instead of the algebraically identical
y= 1./(1-0.05*x.^b)
(Note my use of ./ and .^. This is important.)
And with that model, I seriously doubt you will get a very good fit, and I have not even seen your data. That model has very little capability of adjustment.
  1 Comment
sarah
sarah on 30 May 2015
Edited: sarah on 30 May 2015
my y data ranges from 1-6 but yeah i have alot of points.
so say if my experimental data is y. And say if I want to solve for b ie. the most ideal value of b. So there is no way i could do that? I think even a point of intersection which shows one value of b is good for me. As long as i get a good estimate of b - i was initially thinking of a surface plot. I do know that x ranges from 2-40. haha

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!