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

조회 수: 2 (최근 30일)
Sean Lee
Sean Lee 2015년 12월 22일
편집: Matt J 2018년 6월 26일
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
Joe Goddard
Joe Goddard 2018년 6월 25일
I can provide a recently written Matlab program to estimate a master curve using fmincon. Joe Goddard jgoddard@ucsd.edu

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2018년 6월 25일
편집: Matt J 2018년 6월 25일
For a single coefficient, it's as simple as,
C=((xdata(:)).^2)\ydata(:);
  댓글 수: 5
Joe Goddard
Joe Goddard 2018년 6월 26일
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 2018년 6월 26일
편집: Matt J 2018년 6월 26일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by