y=A/x+B Formula fitting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
y=A/x+B Formula fitting
Solved! Go to Solution.
- Labels:
-
Programming
- Tags:
- mathcad
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
So you think he wanted to to ask for a linear regression and it should read y=A*x+B and he just accidentally wrote y=A/x+B ?
Possible. I thought he would like to fit a hyperbola and as I already indicated I think a hyperbola would at least need some sort of horizontal displacement (B) and better also some vertical displacement (C) - and of course scaling (A).
But a polynomial fit of order 2, a parabola, seems to do a good job as well
Comparing the sum of squared errors we see that the hyperbola offers just a very slightly better fit
Attached sheet uses the y-values provided by Fred and is in P9 format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You may either set up a solve block with "minerr" , minimizing the sum of squared errors, or, more convenient, use the "genfit" function. Look the latter up in he help.
If you need more help, come back here and don't forget to attach your worksheet with the data.
In case you are using Prime, you should also mention which version you are using.
P.S.: I don't think that the function type you have in mind would result in a suitable fit
Rather use y=A/(x+B) or even better y=A/(x+B)+C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If you have a full (paid) version of Mathcad Prime, there is a built-in function:
For those of us muddling along with the free Express version, you can easily do least squares fits of any order polynomial. Two Prime 4.0 files attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
So you think he wanted to to ask for a linear regression and it should read y=A*x+B and he just accidentally wrote y=A/x+B ?
Possible. I thought he would like to fit a hyperbola and as I already indicated I think a hyperbola would at least need some sort of horizontal displacement (B) and better also some vertical displacement (C) - and of course scaling (A).
But a polynomial fit of order 2, a parabola, seems to do a good job as well
Comparing the sum of squared errors we see that the hyperbola offers just a very slightly better fit
Attached sheet uses the y-values provided by Fred and is in P9 format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Sorry, I've got to learn to read more carefully.
Attached is my least squares fit to a parabola. The hyperbola fit is included but fails. (Well, you get a fit but if you look a Werner's function you can see why there's no success--I've got the wrong form of expression. Adjusting the formula (and stealing Werner's value for B) has been included.
File is Prime 4, readable in any Prime greater than or equal to 4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I am always fascinated by the clever workarounds to find a solution even in Express. Chapeaux!
