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

2 Ansichten (letzte 30 Tage)
Yannick Geiger
Yannick Geiger am 13 Feb. 2020
Kommentiert: Alberto Chavez am 2 Apr. 2020
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)

Antworten (1)

Alberto Chavez
Alberto Chavez am 20 Mär. 2020
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 Kommentare
Yannick Geiger
Yannick Geiger am 22 Mär. 2020
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 am 2 Apr. 2020
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by