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 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
dpb
le 19 Juin 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?
Réponses (1)
Jan
le 19 Juin 2017
Modifié(e) : Jan
le 19 Juin 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)));
Voir également
Catégories
En savoir plus sur Matched Filter and Ambiguity Function dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!