cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Minimize point-slope function vs. measured data

RB_10629869
3-Visitor

Minimize point-slope function vs. measured data

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

 

View solution in original post

2 REPLIES 2

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

 

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

 

Top Tags