Recognise specific pattern in timetable
Afficher commentaires plus anciens
I have a timetable logfile from an electrical motor.
This motor runs a variable rounds per minute, according to manual adjustment.
if i plot the entire timeline vs rpm i get what like in attached picture "1".
The intresting part of that data is where you see the rpm drops from ~2250 rpm to ~1300rpm. please see picture "2".
Is it possible to make a code that is recognising this specific pattern automatically, and isolate the time where this is happening? in this case it must be isolated from ~60s to ~100s to isolate this specifik range.
Thanks!
2 commentaires
Star Strider
le 9 Mai 2022
The findsignal function is the only method that I am aware of that would easily do this sort of pattern-matching.
Mads Petersen
le 10 Mai 2022
Réponses (3)
Mitch Lautigar
le 10 Mai 2022
1 vote
After you grab the data, run a simple check to see if the rpm's drastically decrease. This can look something like the following
%rpms_val is the name i'm use for your "y" data points.
%rpms_time is the name i'm going to use for your "x" data points.
rpms_slope = [];
for i = 1:length(rpms_val)-1
rpms_slope(i) = (rpms_val(i+1) - rpms_val(i)) / (rpms_time(i+1)-rpms_time(i));
end
rpms_check = find(rpms_slope < -5) %-5 can be whatever tolerance you want.
from here, you can code in any flags you wish. You can even change the color of the data that is negative.
2 commentaires
Mads Petersen
le 10 Mai 2022
Mitch Lautigar
le 16 Mai 2022
rpms_slope(i) = (rpms_val(i+1) - rpms_val(i)) ./ (rpms_time(i+1)-rpms_time(i))
forgot it was vector math. Should fix your issue.
Les Beckham
le 10 Mai 2022
Modifié(e) : Les Beckham
le 10 Mai 2022
One approach without requiring the Signal Processing Toolbox:
load('answers.mat') % an approximation of your data
x = data(:,1);
y = data(:,2);
startidx = find(y>2000, 1, 'first'); % you may need to adjust this
% The following line may also need to be adjusted if the desired region is
% not strictly decreasing
stopidx = find(diff(y(startidx:end))>1, 1, 'first') + startidx - 1
plot(x,y)
hold on;
plot(x(startidx:stopidx), y(startidx:stopidx), 'r.')
Mads Petersen
le 9 Juil 2022
0 votes
Catégories
En savoir plus sur Descriptive Statistics dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



