Skip to main content
3-Newcomer
March 23, 2023
Solved

Minimize point-slope function vs. measured data

  • March 23, 2023
  • 1 reply
  • 1254 views

I have a very simple problem as you can see below (file attached too.) I'd like to fit a line to measured data. There's something fundamental about minimize (and solving in general) that I don't understand and can't seem to find by searching through the literature. Changing TOL and CTOL have no effect. Help?

RB_10629869_0-1679531934806.png

 

 

Best answer by Werner_E

To use "minimize" you have to make "Residual" a function depending on the two arguments "Slope" and "Offset".

But the result you achieve when you use "stdev" is not what you are looking for!

Werner_E_0-1679534343707.png

Actually the slope is OK , but the Offset is zero.

 

Here is a better way to get the line

Werner_E_1-1679534416940.png

 

For other ways to do a linear regression you may lookup the examples in the help files: Example: Linear Regression

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
March 23, 2023

To use "minimize" you have to make "Residual" a function depending on the two arguments "Slope" and "Offset".

But the result you achieve when you use "stdev" is not what you are looking for!

Werner_E_0-1679534343707.png

Actually the slope is OK , but the Offset is zero.

 

Here is a better way to get the line

Werner_E_1-1679534416940.png

 

For other ways to do a linear regression you may lookup the examples in the help files: Example: Linear Regression

 

3-Newcomer
March 23, 2023

Thanks! I appreciate the dual methods. What I wasn't getting was how to make "functions" believe it or not. I'll be attempting things much more complicated than linear fitting so I'll need more general approaches.
This worked: 

RB_10629869_0-1679552502837.png