Robust edge/flank detection - HELP!!
62 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Star Strider
2019 年 1 月 27 日
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 件のコメント
Star Strider
2019 年 1 月 28 日
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.
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!