Creating cell array for values in a signal vector that cross a certain threshold
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a 1599 x 54 double matrix called aefm_4 were the columns represent observations (signals) and the rows represent time steps. For each column, I want to find the row number where the value is equal to 10. For example, I have a signal (whose signal vector is a certain column number in the matrix) as seen in the picture below and I want to find the x values (row number) of where the threshold (red line) and signal (blue line) cross. Not every signal will cross this threshold exactly 10 times, thats why I want to make it a cell array. Also, the y values wont be at exactly y=10 so i need to find the values directly above and below y=10 and then interpolate. If anyone could help me with this or at least get me started, that would be great.
0 commentaires
Réponses (1)
Image Analyst
le 13 Oct 2020
Is this homework?
Here's a start. It gives you the elements just before where it crosses 10. Take the element after and do a blinear interpolation with interp1. I trust you can do that but let us know if you can't figure it out after a good attempt.
data = 100 * rand(1599, 44) - 50;
[rows, columns] = size(data);
for col = 1 : columns
thisColumn = data(:, col);
plot(thisColumn, 'b-');
% Draw threshold.
yline(10, 'Color', 'r', 'LineWidth', 2);
% Draw y axis.
yline(0, 'Color', 'k', 'LineWidth', 2);
drawnow;
risingIndexes{col} = strfind(thisColumn' > 10, [0, 1]);
fallingIndexes{col} = strfind(thisColumn' > 10, [1, 0]);
end
5 commentaires
Image Analyst
le 14 Oct 2020
You forgot to attach your script and data (aefm_4), so how can we debug your program for you???
Voir également
Catégories
En savoir plus sur Matrix Indexing 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!