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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Strategy in algorithm for finding the linear equation from experimental data--advice needed

ptc-4735478
1-Newbie

Strategy in algorithm for finding the linear equation from experimental data--advice needed

Hi everyone,

It has been a while since I last posted, I hope you are all doing well!

I have some experimental data that looks like a cubic function with three approximately linear part; the head and the tail has a steep slope and the middle part always has the smallest slope. The linear equation to the middle part is what I am interested in. The problem is: in some data the may only be the first two part, or the first two part look very similar and the third part is missing.

I already wrote a program in MC15 to find the slope of the middle part and the following is my strategy:

divide the curve into say 6 to 7 or more sections and use polyfitc 1st degree to fit each section

find the section with a minimum slope

find all other section within 1 stdev of the minimum slope, which is given by polyfitc, combine all these section and do another polyfitc on the combined section.

Since the curve looks like continueous and the three region have different slope, so I did not constraint only adjecent section can be combined.

But once in a while, if the three parts look indistinguishable (or the last part is missing), I have a linear fit that is parallel to my data instead of on it...

Then I make a second condition: if the linear fit using all data points can fit those combined section better than just using a portion of the data, this mean my entire data set looks very linear, then I use a linear line that fit all data available.

I would like to learn what is other strategy to do what I want. I tried to identify the transition region between different quasi-linear part, but I do not know how to do that. Now my program needs about 2 minutes to go through 95 data set with 1700 data point each. Is there a more efficient way ?

Thanks

Henry

1 REPLY 1

It might help to post sample data files and whatever, but it seems you have a satisfactory solution anyway and 2 minutes for roughly 100 files isn't that bad, either.

How good is the fit with a cubic for the whole data range? If good enough you mya be able to have succes with an analytical treatment of that function - finding extrema to get the point of transition, etc. Not sure if it would be a good idea for all cases you may encounter.

Top Tags