MATLAB: How to find the threshold of a matrix

matrixthreshold

Iam working on FFT algorithm.The FFT is applied to an image and it resulted in complex number matrix.Now I have to find threshold of the FFT resulted matrix and set the values of matrix to zero which are below threshold.Then apply IFFT to reconstruct.But Iam not able to find threshold of matrix.Any help appreciated.Thanks in advance

Best Answer

rng(0)
x = randn(1,32);
X = fft(x);
absX = abs(X);
M = max(absX);
absX(absX < M/100) = 0;
z = ifft(absX.*exp(i*angle(X)));
err = max(abs(z-x))
err =
4.4419e-016
Thank you for formally accepting my answer
Greg