Solving large system of equations without explicit solution

Hello all,
I'm trying to develop a model in MATLAB for some of my data. I'm pretty much at my last point except what I thought would work, didn't. I have a set of 11 equations, each one a different datapoint evaluated at my input variables. Between these 11 equations, I have 8 constants that I need to solve for. MATLAB is irritated because I have more equations than variables and because there isn't an explicit solution. I know I won't be able to get values for my constants that satisfy all 11 perfectly. I thought "solve" would act like a regression and find the best fit given all 11 equations but evidently it doesn't. Is there a way to do what I want that I've missed?
Thank you for your time and assistance.

답변 (1개)

Walter Roberson
Walter Roberson 2011년 9월 14일

1 개 추천

Sorry, solve() is part of the symbolic toolbox, and does not handle regressions.
The symbolic toolbox tool that would at first appear to be most appropriate would be stats::reg .
However, this will not necessarily be any better than MATLAB's usual nonlinear regression tools, if you already know the equations.
Please note that stats::reg is part of the MuPad standard library, and does not have a direct interface to MATLAB itself. To use it, you will need to use either evalin(symengine,....) or else feval(symengine,'stats::reg',....)

댓글 수: 3

Thanks. I ended up reassembling my equations into a matrix by hand and just using A\b. I completely didn't think about just treating it as a matrix regression. If anyone knows a quick way to pull all the constants out of a symbolic expression so I don't have to keep doing this by hand I'd be much obliged, but thanks for helping me to think about it in a different way!
What form are the symbolic expressions? If they are polynomials then the coefficients can be extracted using coeffs or sym2poly.
It's a polynomial! Coeffs just made my life beautiful. Thank you so much!

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

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

질문:

B K
2011년 9월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by