Edge Detection without function

58 ビュー (過去 30 日間)
Fifit Yulianti
Fifit Yulianti 2018 年 11 月 12 日
コメント済み: Holden Tranquillo 2023 年 9 月 20 日
How to make edge detection manually / without Matlab function?
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 11 月 12 日
What operations are you permitted? For example in MATLAB, the == operator is a function.

サインインしてコメントする。

回答 (1 件)

Luna
Luna 2018 年 11 月 12 日
Hello Fifit,
Signal should be a vertical vector. Value is a constant double. Index is the result which is a logical array where rising or falling edge occured.
Try this code:
signal = [10 10 5 5 2 2 2 5 5 8 8 5 5]'
value = 5;
This is for rising edge:
locations = (signal >= value);
diff_locations = [false ; diff(locations)];
index = (diff_locations ==1);
This is for falling edge:
locations = (signal <= value);
diff_locations = [false ; diff(locations)];
index = (diff_locations == 1);
  1 件のコメント
Holden Tranquillo
Holden Tranquillo 2023 年 9 月 20 日
Great method, thanks

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by