function overall = global_threshold(ATH, tone_power, noise_power, b) % global_masking_threshold = global_threshold(absolute_threshold_of_hearing, % tone_power_spectral_density, % noise_power_spectral_density, % bark_spectrum) % % global_threshold takes the absolute threshold of hearing as well as the % spectral densities of noise and tones to determine the overall global % masking threshold. This method assumes that the effects of masking % are additive, so the masks of all maskers and the absolute threshold % are added together. % begin with zeros temp1=zeros(1,length(tone_power)); %figure; %hold on; %plot(b(find(tone_power)), tone_power(find(tone_power)), 'rx'); % go through tone list for k=find(tone_power), % determine the masking threshold around the tone [thres, start]=mask_threshold(1,k,tone_power(k),b); %plot(b(start:start+length(thres)-1), thres); % add the power of the threshold to temp in the proper frequency range temp1(start:start+length(thres)-1)=temp1(start:start+length(thres)-1)+dbinv(thres); end %plot(b,10*log10(temp1), 'c'); %xlabel('Frequency (Bark)'); %ylabel('Power (dB)'); %title('Tones and Related Thresholds'); temp2=zeros(1,length(noise_power)); %figure; %hold on; %plot(b(find(noise_power)), noise_power(find(noise_power)), 'ro'); % go through noise list for k=find(noise_power) % determine the masking threshold around the noise masker [thres, start]=mask_threshold(0,k,noise_power(k),b); %plot(b(start:start+length(thres)-1), thres); % add the power of the threshold to temp in the proper frequency range temp2(start:start+length(thres)-1)=temp2(start:start+length(thres)-1)+dbinv(thres); end %plot(b,10*log10(temp2), 'c'); %xlabel('Frequency (Bark)'); %ylabel('Power (dB)'); %title('Noise and Related Thresholds'); temp=temp1+temp2; % finally, add the power of the absolute hearing threshold to the list for k=1:length(ATH), temp(k)=temp(k)+dbinv(ATH(k)); end % all effects have been added, so now change to dB, the way everything else has been. overall=10*log10(temp);