Change in slope detection

7 views (last 30 days)
Michal Kotze
Michal Kotze on 13 Feb 2015
Answered: Michal Kotze on 14 Feb 2015
Hi
I have a bin that is filled with water, when it is full it wil start to overflow but the volume measured when it reaches the full level should be constant but due to the errors in volume sensors it is not always perfect. The level of the if the bin can be changes thus overflow could occur at a lower volume, thus i cannot use a threshold method. I also cannot use the last value of the data set to use as threshold as the volume measurement is not always perfect and could result in picking to high threshold or to low. In a perfect world the filling of bin should be straight line measurement and when overflow is reached it should be a straight line. If this was the case i could take the second derivative to find the change is slope. Unfortunately this is not the case and when i take the second order derivative I get the the results shown in the attached picture. Is there a way to detect this change in slope with better method. Keep in mind, since the level (Volume) can change and the rate at which it fills up no data set will be the same. I not not have the information of what level the bin is set in the data logs. Since the slope changes and the duration before overflow i cannot curve fit the slope as this changes between measurements. Doing it manually it is easy to spot but i need algorithm that automatically detects the change in slope. Thank for any help.
  2 Comments
John D'Errico
John D'Errico on 13 Feb 2015
What attached picture? Try again.
Michal Kotze
Michal Kotze on 13 Feb 2015
I attached the figure now

Sign in to comment.

Answers (1)

Michal Kotze
Michal Kotze on 14 Feb 2015
Hi
I solved the problem. By finding the average of the last couple of sample at the end of data set I could find an estimate of the max volume in bin and then i subtract a value from it which will give me a point on the sloped line segment. I then to a first order curve fit and find the line equation. I then subtract the measured volume from this line equation. By setting a threshold limit i can find the indices where the line splits from the straight line segment (volume full section). This allowed me to automate the process. This gives a good approximation of the start of overflow of the bin. Just a brief description, however i would still like to know if there is another better method to detect this change in slope with some algorithm?
Any input will be appreciated
Met vriendelijke groeten / Met vriendelike groete
Michal Kotzé

Categories

Find more on Curve Fitting Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!