How to Envelope a Dataset?

조회 수: 30 (최근 30일)
Aviator
Aviator 2011년 12월 16일
I have a series of data points (in some cases they're in the order of over 1000 points), after some data processing and iterations i.e. sorting, duplicate elimination etc. they will look like a numerical array like "B". B(:,1) will represent the data set on the X-Axis and B(:,2) is the corresponding Y-Axis data.
B =
20 0.01
34 0.017
40 0.02
56 0.5
71 0.2
71 0.5
80 0.04
100 0.075
200 0.2
260 0.04
400 0.5
800 0.04
2000 0.01
2000 0.02
*Please note that there are 2 corresponding values for 71.
I'd like to create an array that envelopes these data to represent the characteristics of "B". I came up with the enveloping dataset manually (which is acceptable for this case). I called this enveloped data set, "Enveloped":
Enveloped =
20 0.01
30 0.02
45 0.5
400 0.5
2000 0.02
I have uploaded a figure at the following link; it can visually show you what I'm looking for:
The Red plot represents "B" and the blue plot is the "Enveloped". I'm looking to recreate "Enveloped" in Matlab. Any help is greatly appreciated!

채택된 답변

Junaid
Junaid 2011년 12월 18일
Dear Aviator, Sorry I was away so could not reply on time. Actually you can play trick with this.
k = convhull(x,y)
So you can process k after getting convhull. To avoid box around point it is straight forward that delete the last point. However there can be many exceptions. One good trick can be that. You loop over k and check values of K. Keep plotting while K is increasing. Whenever K start decreasing then you stop. You will see that you don't get box and get the exactly same figure which you showed as example. Sorry I don't have installed matlab to test but I am sure it will work. Try and let us know.

추가 답변 (1개)

Junaid
Junaid 2011년 12월 16일
Dear Aviator,
Actually your problem is quite related to finding the Convex hull. The data points you have shown are not good enough so that I could show you example visuall. But take a look at this.
I hope this will solve your problem. You have to find the convex hull that you are calling an envelope :-). Do let me know if you understood your question wrong.
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2011년 12월 16일
Use accumarray with the function max() to group your data and keep the ones you want. (histc or unique to get the indices to feed accumarray)
Aviator
Aviator 2011년 12월 17일
Can you be a little more specific? For this particular problem I happen to know the end result so I could pick what I wanted to get to my desired plot but in all other cases that I don't have the end result to compare my Matlab outcome to, it's a different story. I'm trying to come up with a general approach to envelope a set of data. It's exacly similar to the "convhull" but with some restrictions...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by