Defining boundaries of a curve
    6 views (last 30 days)
  
       Show older comments
    
Context: I have attached some example histograms I've extracted from my data. As a simple/quick form of data clustering, I would like to find the boundaries of the curves present in the histograms (I've changed the raw counts to percentages).
Problem: None of the methods I have used thus far (gradient, findchangepts) have given me precise or robust solutions. This not being my area of expertise, I'm not really sure how to refine my questions beyond the following:
Question: How can I set up an algorithm which will approximately ID the following indecis as pairs for the given data sets
Dat1: [3, 18], [21, (24 or 25)], [25, 31], [33, 37]
Dat2: [6, 17], [52, 54]
Dat3: [(4 or 5, even 6 would be acceptable in a pinch), 15].
I will emphasise that these are the examples I've pulled out of my data thus far. Ideally, the algorithm I want to create will be able to operate over an arbitrary number of curves with 0 a priori knowledge. It is entirely possible, though unlikely, that a data set might have no curves/clusters, or very weakly-defined/low-prominence ones.
1 Comment
  Stephen23
      
      
 on 12 Sep 2023
				S = load('HistogramData.mat')
scatter(S.Dat1(:,1),S.Dat1(:,2))
scatter(S.Dat2(:,1),S.Dat2(:,2))
scatter(S.Dat3(:,1),S.Dat3(:,2))
Accepted Answer
  Stephen23
      
      
 on 12 Sep 2023
        S = load('HistogramData.mat')
P = 8e-4; % prominence
D1 = diff([false;S.Dat1(:,2)>P;false]);
D2 = diff([false;S.Dat2(:,2)>P;false]);
D3 = diff([false;S.Dat3(:,2)>P;false]);
M1 = [find(D1>0),find(D1<0)-1]
M2 = [find(D2>0),find(D2<0)-1]
M3 = [find(D3>0),find(D3<0)-1]
4 Comments
  Stephen23
      
      
 on 14 Sep 2023
				"I will add the "curve shape matching" term to my self-education."
You might find something useful in this toolbox:
Another option might be to try some kind of machine learning to classify those curves:
More Answers (1)
  Image Analyst
      
      
 on 14 Sep 2023
        
      Edited: Image Analyst
      
      
 on 14 Sep 2023
  
      "what I'm trying to do is akin to density-based clustering"
You might like to learn about dbscan
help dbscan
Wikipedia description with diagram:
I've also attached a demo.
0 Comments
See Also
Categories
				Find more on Statistics and Machine Learning 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!




