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?
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); plot(time,[data,dataCompact]); xlabel('Time') ylabel('Amplitude') legend('Data',['DataCompact (',num2str(100*pDataThreshold),'%)']) grid on
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.