function result = SNR(oriData,domainFreq,freqFrom,freqTo,resolution)
% result = SNR(oriData, domainFrq,freqFrom, freqTo,resolution)
x_axis = (freqFrom*resolution+1:freqTo*resolution+1);
domainFreq = domainFreq*resolution+1;
fft_result = abs(fft(oriData));
%plot SNR= SNR_hz_we_want/mean(freqFrom->freqTo, excep SNR_hz_we_want)
snr_sum =0;
%     snr_sum = sum(fft_result(channel,x_axis));
%     snr_result(channel,:) = fft_result(channel,x_axis)/snr_sum*100;

% SNR = fundamental freq / average noise.
result = fft_result(x_axis(domainFreq-(freqFrom*resolution))) / ((sum(fft_result(x_axis))-fft_result(x_axis(domainFreq-(freqFrom*resolution))))/(length(x_axis)-1));

% snr_sum = sum(fft_result(x_axis))-fft_result(x_axis(domainFreq-(freqFrom*resolution)));
% result = fft_result(x_axis(domainFreq-(freqFrom*resolution)))/(snr_sum);

end