Using MATLAB signal processing toolbox, I have created signals like dirichlet, chirp and etc and and obtained their fourier and cosine fourier transform. Now I want to find the frequency where for example A% frequencies are less than that and use it as a thresholding frequency to compact the signal and eliminate unnecessary details? Could you please tell me a little more about thresholding frequencies and how to choose them in signal processing?

  • $\begingroup$ @John, please post your comment as an answer. I doubt this question will get any proper attention otherwise. $\endgroup$
    – Phonon
    Commented May 13, 2014 at 4:05

2 Answers 2


A Matlab code and illustration is given below, with the discrete cosine transform (DCT):

nSample = 512;
pDataThreshold = 90/100 ; % percentage, as a float in [0 1]

time = linspace(0,1,nSample)';
data = sin(2*pi*4*sqrt(time));
dataTrans = dct(data);
dataThreshold = quantile(abs(dataTrans),pDataThreshold);
dataTransThreshold = dataTrans;
dataTransThreshold(abs(dataTrans) < dataThreshold) = 0;
dataCompact = idct(dataTransThreshold);

legend('Data',['DataCompact (',num2str(100*pDataThreshold),'%)'])
grid on

enter image description here


If I understand you correctly, you should be able to sort all N bins by increasing magnitude, select the magnitude at position A*N/100 in the sorted array, and then discard any frequencies with magnitude less than that in the original array.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.