이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Picking exact data on a plot with ginput
조회 수: 13 (최근 30일)
이전 댓글 표시
I plot a line with experimental data (x,y). Then I want to pick, with ginput, EXACTLY, some of the data on the graph. Is it possible? How can be done?
답변 (1개)
Adam Danz
2019년 10월 25일
See this answer. It shows two methods of obtaining the coordinates of a data point by clicking on it. The ginput() idea is explained in method #2. If you have any other quesitons, feel free to comment here (or in that link).
댓글 수: 15
Luigi Sambuelli
2019년 10월 25일
Thank you, i really did skrew my problem following this suggestion. But...
Luigi
Adam Danz
2019년 10월 25일
Sorry, I didn't understand. Did you come across a new problem or is there a problem with the implementation of the proposed solution? I'd be glad to help out.
Adam Danz
2019년 10월 25일
Luigi Sambuelli 's answer moved here as a comment.
MMM sorry, I was "obscure". I need to find some points on a graph (that have to be some of the "experimental points" used to make the graph) in order to calculate a detrending broken line (detrend command does not work because the signal is "unbalanced" around zero, yet nearly periodic). The point is that I do not know in advance how many points I will select to build these detrending lines... It's a messy problem..
Thank you anyway for your suggestion.
Luigi
Adam Danz
2019년 10월 25일
If you can formalize the problem or perhaps map it out in a diagram I might be able to help further.
Adam Danz
2019년 10월 28일
Thank you Adam for your efforts. In the attached figure you'll see some of the signals I've to detrend. Thank you anyway.
Luigi

Adam Danz
2019년 10월 28일
________________________________________________
In your original quesiton, you wanted to use ginput() to choose a datapoint on the graph and it looks like you're trying to determine where your two datasets start to bifurcate. Is this still your goal?
It's unclear whether you're still seeking help on this topic. If you are, I'd be glad to help but I need to understand exactly what the goal is.
Adam Danz
2019년 10월 28일
_______________________________________________
The two signal in the figure are measured independently by two sensors in two different places. Both of them have a drift (that sometimes is a broken line, not a straight line fron the beginning to the end). Each drift is different from the others. I'm trying to remove these dirfts. The matlab DETREND command does not work in this case because, searching for the liast square interpolating line, it works badly with signals that "have no zero mean around their linear trend". In this case the interpolating line takes into account the minima. My idea is to pick 2 points in the linear parts of the graphs, calculate a straight line passing in these two points and subtract this straight line to the original data. In fact the linear part in the signals shoul be horizontal i.e. have a costant value. That's why I was looking for a way to pick exactly two data points.
LS
Adam Danz
2019년 10월 28일
편집: Adam Danz
2019년 10월 28일
Hmmm I've never used detrend() but I took a look at that documentation and does seem like it would be the function to use in this problem.
Your idea to pick 2 points in the linear parts of the graph is subjective and therefore not generalizable to other sets of data. Instead, have you tried using the "break point" (bp) option in detrend()? y = detrend(x,n,bp)
"DETREND command does not work in this case because, searching for the liast square interpolating line, it works badly with signals that "have no zero mean around their linear trend""
Would you happen to have a plot that shows the results along with whatever input options you used in detrend()? I'm curious what "works badly" looks like.
Please use the link below that reads "Comment on this Answer" unless you are proposing a solution to your question.
Luigi Sambuelli
2019년 10월 29일
Here two signals: before and after detrend. An offset is clearly visible. In my opinion it comes from
y = detrend(x) removes the best straight-line fit
and it does this even if you select 2 or 3 break points between each consecutive couple of points.
Adam Danz
2019년 10월 29일
One possibility is that the trend isn't linear. The slope of the 2nd rise in your black data seems to be slightly larger than the slope in the 1st rise.
My first suggestion would be to try to optimize your detrend() inputs. What breakpoints did you use?
My 2nd suggestion would be to break up your data into two segments: 1) all data prior to the the jump-up at around the 1st week of Feb 2018 and 2) data the follow that point; and then to run detrend on each segment of data.
Luigi Sambuelli
2019년 10월 30일
Indeed I selected 2 break points (bp) obtaining 3 interpolating lines: one before the first bp, the second between the 2 bp and the 3 bp and the last from the 3 bp to the end of the signal. But, as you wriote (and I agree absolutely with you) the choice of the break point are "empirical". I'm afraid that this is a kind of "hill posed" problem. Thank you very much for the time you spent around my stuff.
Adam Danz
2019년 10월 30일
No problem - I enjoy it ;)
Depending on how much time you have to play around with the data, you might try breaking up the data into ~3 segments and applying detrend() to each, and then stitch them back together.

Luigi Sambuelli
2019년 10월 30일
Yeah this is exactly what I've been doing for the last 2 or 3 weeks :-)
Thank you very much again.
Luigi
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
