필터 지우기
필터 지우기

I have a signal and have marked and plot any points that exceed a power threshold. How can I create a new array of the data points that exceed the threshold? The distance between each point is differs slightly so I can't just write x:y:z

조회 수: 2 (최근 30일)
The distance between each point is differs slightly so I can't just write x:y:z. I need to just take exactly the points above the threshold and put them into an array.
The array is from over_x(1):over_x(end), but I don't know how to include all the points in between.
Thanks in advance
  댓글 수: 2
dpb
dpb 2017년 6월 19일
If over_x is the array of points
over_x=x(x>threshold);
then you've already got it.
The expression over_x(1):over_x(end) is shorthand for over_x(1):over_x(length(over_x)) and is equivalent to just writing over_x without any subscript expression.
Not sure what the issue is, precisely??? Can you explain more of what the difficulty is you're having?
Veronica yep
Veronica yep 2017년 6월 19일
Damn I was overthinking it you're right I already had the array there, thanks for pointing it out for me though! to explain a little further, I am measuring signals within a band but do not want to measure the same signal more than once and so I want to get the array of points over the threshold (signal to be measured) and comparing other data that exceeds the threshold to this array to determine whether the signal in this range is already being monitored

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

답변 (1개)

Jan
Jan 2017년 6월 19일
편집: Jan 2017년 6월 19일
You forgot to mention, how your data are available. If I guess this detail, it might differ from your setup and confuse you. But I try it:
t = sort(rand(1, 1000)); % The non-uniform x values
y = bsxfun(@plus, rand(1, 1000), linspace(0, 2, 1000));
figure;
subplot(1,2,1);
plot(t, y);
Now get all values above a limit:
index = (y > 2);
subplot(1,2,2);
plot(t(index), y(index));
Or perhaps you want to get all values from the first value above the limit to the last one? The question is not clear in this point.
index = find(y > 2);
plot(t(index(1):index(end)), y(index(1):index(end)));
  댓글 수: 1
Veronica yep
Veronica yep 2017년 6월 19일
I thought I may have been a little vague my apologies, you're right in the last thing you say I just wanted the values from first to last. I explained a little bit about the end goal above. Thanks for the quick reply though dude

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

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by