Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

use python to selve ! For each element Mij in M (start with window size m) V1= W

ID: 3874161 • Letter: U

Question

use python to selve !

For each element Mij in M (start with window size m) V1= W(median) – W(min) V2= W(median) – W(max) If (V1 > 0 and V2 < 0) Then Q1=Mij-W(min) Q2=Mij-W(max) If (Q1 > 0 and Q2 < 0) Return Mij Else return W(median) Else increase window size If window size <= max repeat calculations Else return Mij In cases when the window exceeds the edges of the matrix M then all window elements outside of M are zeros (figure on the right)

we have to reduce the noise effect. This was done by adding more sensors (N sensors). And reading each one of them N times at fixed time intervals, The result is a NxN matrix of sensors' readings. So far, the noise is still present in the readings. You task is to write a python implementation of the following algorithm to reduce the noise in the NxN data obtained from the sensors. M: is the N X N matrix of input Mij: is the current element we are processing W: is the window of size m x m where the My is the center of the window, m is between [3 - Max], Max-11 Window W Mij 01

Explanation / Answer

import numpy as np

N=int(input("Enter the number of sensors: "))

M=np.matrix(N*N) # N sensors read N times at fixed interval,storing values in M.

W=np.matrix(m*m) # m is between [3-max] & max=11.

for i in M: #read each value of the matrix one by one

for j in M:

v1=W(median)-W(min)

v2=W(median)-W(max)

if(v1>0 && v2<0):

Q1=M[i,j]-W(min)

Q2=M[i,j]-W(max)

if(Q1>0 && Q2<0):

return M[i,j]

else :

return W(median)

else :

W=W+1

if(W<=11):

repeat calculations #from line8

else :

return M[i,j]