How to fit a parameter-linked two-equations system?
6 ビュー (過去 30 日間)
古いコメントを表示
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)
0 件のコメント
回答 (1 件)
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 件のコメント
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 Center および File 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!