How to apply curve fitting with a model where y shows up on both sides of the equation.

2 ビュー (過去 30 日間)
I have a set of data to fit with the following equation: y=a*(((4*(1-x/b+y/c))^-2)-0.25+x/b-y/c), where x and y are the independent and dependent variables, respectively. Coefficients are a, b, and c. As you see, y shows up on both sides of the equation. I tried to generate this equation in Matlab curve fitting tool box, however, it does not allow y to be on the right side of the equation. Do you have any idea how to apply this equation to fit the data? Thanks ahead.

採用された回答

Walter Roberson
Walter Roberson 2012 年 4 月 7 日
Multiply through by the (4-4*x/b+4*y/c)^2 denominator of the partial fraction, and re-arrange terms to get a cubic in y.
Unfortunately with it being a cubic, there are going to be 3 solutions, so you need to analyze the solutions to determine which ones are feasible. If you extract the solutions using a symbolic algebra package (e.g., symbolic toolbox solve()) then you will get three solutions. If you examine the solutions, you will see that all of them include the sub-expression
sqrt(a*b*((3*a^2*c+(32/27)*c^3+(19/6)*a*c^2+a^3)*b^3-2*x*(a+(4/3)*c)^2*c*b^2+(8/3)*x^2*(a+(4/3)*c)*c^2*b-(32/27)*x^3*c^3))
Now if you solve() to find the zeros of the inside of the sqrt() with respect to x, you will find three solutions for x. Two of the solutions involve sqrt(-1). The third solution is
(1/4)*b*(3*(a*(c+a)^2)^(1/3)+3*a+4*c)/c
Under the assumption that the variables are all real-valued, then the inner expression there, (a*(c+a)^2)^(1/3) is certain to have a real root (which will be positive if a > 0). Then by examination we can see that the third solution expression overall will always be real-valued for real coefficients. And that implies that for any real a, b, c, there is a set of real-valued x for which the sqrt() expression that is common to all the solutions of y will become complex. Which leads you to the regretted possibility that for all real-valued coefficients a, b, c, there are x for which one of the three roots of y is real-valued, and there are other x for which that first root becomes complex but the other two roots become real-valued. And that implies you cannot discard any of the three roots of y, that at varying x they all express valid solutions.
Curve-fitting to a set of three expressions that are known to go complex is probably not going to be much fun at all. Perhaps you happen to have information about x relative (symbolically) to a, b, c, that would eliminate this possibility? If not then you have a "fun" time constructing the equation as a piecewise equation and trying to deal with the dual solutions at times...

その他の回答 (2 件)

Sargondjani
Sargondjani 2012 年 4 月 7 日
i know how you could get your a, b and c using lsqnonlin (minimizing least squares), but im not sure if the statistical properpties are what you want them to be
to do it with lsqnonlin you would have to write a function in the format: F(par,x,y)= y - (right hand side); %this should return a vector with the residuals, where par is a vector with [a,b,c], so par(1) instead of 'a', etc.
then optimize: [par]=lsqnonlin(function,par0);
i suppose there is nicer way to do it, but this could get you started...

Zhongbo
Zhongbo 2012 年 4 月 7 日
Thank you, guys. I am starting from your points to see whether I can get through.

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by