Remove peaks less than a threshold

Hello guys, I'm dealing with analysis of a spectra and I found that there are many unwanted small peaks in it(see the image). I want to remove the peaks that has the intensity (abscissa) less than say 15.0. Is there any function in matlab that does this. Can someone get me a script for that.
Im attaching my file here

댓글 수: 1

Adam
Adam 2016년 11월 25일
편집: Adam 2016년 11월 25일
What do you mean by 'remove them'? Set only the peak values to 0? Doing only this would obviously result in new small peaks in most places where the newly zeroed point would cause small peaks either side of it.
You can use various settings in the findpeaks function if you have the signal processing toolbox in order to not include the small peaks, but by the sounds of it you want to get rid of them from your spectrum rather than just find the peaks that do matter.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2016년 11월 25일

1 개 추천

To set values smaller than some threshold to zero, do this:
threshold = 15; % Whatever....
elementsToSetToZero = y < threshold;
y(elementsToSetToZero ) = 0;
I think Adam's comments about small side peaks getting created was if you zeroed out tall spikes, not short ones. Or else he was zeroing out just the single element at the very peak instead of everything (multiple elements) less than some threshold value. My code above will not create any additional peaks.

댓글 수: 4

Adam
Adam 2016년 11월 25일
편집: Adam 2016년 11월 25일
Yes, that works well. I got too fixated on the question of just removing peaks (i.e. the single identified peak samples) rather than just zeroing everything below the given value, whether peak or not.
Although if it is desired to retain the slope up to the higher peaks the effect of this may be undesirable as it will also trim them down to 0 at their wide base.
Image Analyst
Image Analyst 2016년 11월 25일
Correct. We need to know the intent. Does he just need to know where the center of the tall peaks are? Or does he need to know the total area? If the total area is needed, he might have to start with the very peak and then "fall down" each side of it until the values turn around or at least level off, and do that with the original data, not the zeroed out data.
SAHEER VC
SAHEER VC 2016년 11월 26일
Thank you for the answer. Adam's code works but as pointed our by Image Analyst it zeros everything below the given number. Removing a smaller peak should not affect the larger peaks. See the two images below for example. From the first image I removed two peaks whose intensity is below 100 (removed the x and y data representing the peak). I did it manually, but it a tedious process as there are hundreds of such smaller peaks.
Image Analyst
Image Analyst 2016년 11월 26일
What are you going to do? Why is it so important that the really low tails on the larger peaks be kept intact?

댓글을 달려면 로그인하십시오.

카테고리

태그

질문:

2016년 11월 25일

댓글:

2016년 11월 26일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by