Robust edge/flank detection - HELP!!
Mostra commenti meno recenti
Hey guys,
i have an measurement and read in three rect. signals.
I need to detect the pos. and neg. edges/flanks of the three signals.
Sometimes I have the problem that my code doesnt detect all flanks/edges and i dont know why.
In the attachment u find a pictures with with all three signals and the detected signals but not all are right.
I counted them by hand:
left Signal -> 28 pos. and 27 neg.
middle Signal -> 27 pos and 27 neg (this signal is ok)
right signal -> 27 pos and 27 neg
So if u compare it only the middle one is correct.
My Code for that detection is:
posFlankHall_1 = find(diff(V_Hall_1)>1.6)+1;
negFlankHall_1 = find(diff(V_Hall_1)<-1)+1;
posFlankHall_1OrigLength = length(posFlankHall_1);
negFlankHall_1OrigLength = length(negFlankHall_1);
posFlankHall_2 = find(diff(V_Hall_2)>1.6)+1;
negFlankHall_2 = find(diff(V_Hall_2)<-1)+1;
posFlankHall_2OrigLength = length(posFlankHall_2);
negFlankHall_2OrigLength = length(negFlankHall_2);
posFlankHall_3 = find(diff(V_Hall_3)>1.6)+1;
negFlankHall_3 = find(diff(V_Hall_3)<-1)+1;
posFlankHall_3OrigLength = length(posFlankHall_3);
negFlankHall_3OrigLength = length(negFlankHall_3);
I have three question to that:
1) Is there maby a easier and more robust way to detect the flanks/edges?
2) How can I automatically find out the values (like in this case 1.6 and -1) so i can use it on every signal i read in
3) If there is no easier way is there a way to improve this one?
Thank you very much in advance.
1 Commento
Star Strider
il 26 Gen 2019
See also: Repeating x-axis for rectangular signal
Risposte (1)
Star Strider
il 27 Gen 2019
0 voti
I would have suggested this earlier, however even though it has been part of the Signal Processing Toolbox since R2012a, I just now discovered it.
2 Commenti
youjarr
il 28 Gen 2019
Star Strider
il 28 Gen 2019
That is not mentioned in the documentation.
Try this:
C = midcross(double(X))
If you pass any other arguments to it, double() them as well.
Also, note the related functions at the end of that documentation page.
Categorie
Scopri di più su MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!