How to efficiently threshold a matrix in SIMULINK (remove noise)

1k Views Asked by At

I am doing some optical flow and I have a matrix of velocities, however I would like to discard (replace with zero) the entries which are below a certain threshold. Is there a convenient block that does this on a matrix signal?

3

There are 3 best solutions below

5
On BEST ANSWER

That would be like:

> M= randn(100, 100);
> M(abs(M)< .1)= 0;
> sum(sum(0== M))
ans =  795
0
On

With Simulink, you can use a lookup table with method 'Interp-Extrap", Vector of inputs [0 th th (th+1)], table data [0 0 th (th+1)], with 'th' your threshold. Between 0 and 'th', result is 0, upper that 'th', it's linear.

0
On

if you can tolerate a few blocks (threshold of 1 shown):

enter image description here