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

1 visualización (últimos 30 días)
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 comentarios
dpb
dpb el 19 de Jun. de 2017
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 el 19 de Jun. de 2017
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

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 19 de Jun. de 2017
Editada: Jan el 19 de Jun. de 2017
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 comentario
Veronica yep
Veronica yep el 19 de Jun. de 2017
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

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by