I am doing impedance measurements, where I do a frequency sweep of a test current, and I measure the resulting voltage. Offline, I compute the FFTs of the voltage and current, and I want to make sure that the voltage is above the 'local' noise floor. I don't care if the signal at the test frequency isn't the biggest, as long as it is above the 'local' noise floor.
Below is an example of a signal that's acceptable. The red-dot is the frequency of interest. There are components at least 20dB bigger than the frequency of interest, but the frequency of interest is around 20dB above the 'local' noise floor.
Example 1
Below is a second example which I would want to be alerted to. It appears to be around 10dB above the noise floor, but zooming in you can see that there is another component too close.
Example 2
Example 2 (zoomed)
My ideas so far are to do peak detection on the FFT (i.e. one point at the peak of each lobe), then peak detection again on the peaks, and see if the frequency of interest is a local peak. If so, the "SNR" that I report is the component of interest (in dB) - closest peak-peak (in dB).
Does anyone have suggestions on a good way to calculate the "local SNR"?