Robust edge/flank detection - HELP!!
조회 수: 22 (최근 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!