How do I make a fitting function with the fitting coefficient for x-data?

Hi.
I am trying to fit the experimental data to the mastercurve we have.
I have set of "xdata".
Let's say I have [0,1,2,3,4,5].
Then, the master curve is the function of xdata.
Let's say master = (xdata)^2.
Here, I also have ydata that corresponds to the xdata from the experiment.
My whole set of data are
xdata = [0,1,2,3,4,5]
ydata = [0,1,2,3,4,5]
Here, I want to have a fitting coefficient multiplied on "xdata" to fit the ydata into mastercurve.
Which means, I will have new plot of ydata vs C*xdata and mastercurve as a function of C*xdata.
I tried to write out a fitting function but confused about the setting since the input parameter is changing for both raw data set and mastercurve. (I tried to use lsqcurvefit but xdata is changing so I am confused.)
Can anyone help me on this?
I also want to obtain a R-squared value out of it.
Thank you very much!
- Sean

1 comentario

I can provide a recently written Matlab program to estimate a master curve using fmincon. Joe Goddard jgoddard@ucsd.edu

Iniciar sesión para comentar.

 Respuesta aceptada

Matt J
Matt J el 25 de Jun. de 2018
Editada: Matt J el 25 de Jun. de 2018
For a single coefficient, it's as simple as,
C=((xdata(:)).^2)\ydata(:);

5 comentarios

I believe a derivation is in order. This does not seem to agree with a rigorously derived formula for finding shift factors for a master curve of y vs x.
@Joe - actually, it does. This is the correct answer. There is no need to use fmincon either.
Matt J
Matt J el 25 de Jun. de 2018
Editada: Matt J el 25 de Jun. de 2018
@Joe- I'm not sure how I could "derive" it when my answer consists only of a function call. A\b is a Matlab command which invokes a least squares solver for linear equations A*x=b. I have simply applied it here with the substitutions,
A=xdata(:).^2
b=ydata(:)
x=C
You have provided a numerical formula without a mathematical derivation to back it up. To obtain a "best fit" to the scale factors necessary to reduce a set of curves to a master curve is not a trivial matter. If this is not what you are trying to do, then we are talking past one another. JG
Matt J
Matt J el 26 de Jun. de 2018
Editada: Matt J el 26 de Jun. de 2018
My best interpretation of what the OP was trying to do is to find the scalar C that minimizes
f(C) = norm( C*xdata(:).^2 -ydata(:) )^2
If that much is true, then the solution is trivially given by what I posted.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 22 de Dic. de 2015

Editada:

el 26 de Jun. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by