How to fit a parameter-linked two-equations system?

조회 수: 2 (최근 30일)
Yannick Geiger
Yannick Geiger 2020년 2월 13일
댓글: Alberto Chavez 2020년 4월 2일
Hello,
I could use some tips or guidance for a fitting problem. I have a dataset of x and y values which are described by two equations of type:
x = f(s,t,a)
y = f(s,t,a)
Both equations are linked through the variable a: one value for a gives an x/y-pair through the two equations. s and t are fix parameters which I would like to find out through the fitting process.
Now, how should I proceed? Basically, the program first should fix s and t, then find the a-values which give x-values fitting to the dataset. Then it should use those s, t, and a-values in the 2nd equation to check if the resulting y-values fit the dataset. I'm not sure which modules or commands might be helptful here.
Below you'll find the detail of the equations (v1 and v2 are other parameters which I know; b is there to simplify the expressions) . Thanks in advance for your help :-)
x=(1+2*s*a)/v1*sqrt(a^2-4b)
y=v1*v2/(a+s*(a^2-2*b)+t*b
with b=f(s,t,a)=(a+2*s*a^2-v1)/(4*s-2*t)
Minimum value a can take: a(min)=(sqrt(1+2*v1*(2*s+t))-1)/(2*s+t)

답변 (1개)

Alberto Chavez
Alberto Chavez 2020년 3월 20일
So basically you have a parametric equation and want to solve for "a"? So that you can then find the minimum value of "a" (which I think you need to use partial derivatives) and then use that value to find a fitting curve?
If what I understood is correct then you can try converting all your variables and fixed parameters to symbols, including "x" and "y", and use the "solve" function to solve for "a" in both equations, unify them and then proceed to the next step.
Something like:
solve('2*x == 1','x')
% or (depending on wich version of Matlab you are using)
solve(2*x == 1,x)
% in which you have the equation to solve and the second parameter is the variable to solve for
Is that what you where looking for?
  댓글 수: 2
Yannick Geiger
Yannick Geiger 2020년 3월 22일
Hello,
thank you for your answer, it is kind of what I need. I have found in the meantime that it is best if I solve both functions for "a", so that I have a = f(x) and a = f(y). I don't know if it will be possible to unify both into one equation, if not it should be possible to fit "a" to both x and y using the two equations, as long as I have enough x and y data, and through this find the value of the other parameters.
Alberto Chavez
Alberto Chavez 2020년 4월 2일
To unify you can use the substitute function or the recalculate function. Leaving one equation as it is, f(x)=a; solve for a in with the second equation and use substitute function to replace a in the first with the value of the second.

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

카테고리

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