# Ear Test using MATLAB

I'm trying to test my ear frequency range by using MATLAB. The thing I could not understand is that I can hear the frequencies above 20 kHz. My sampling frequency is enough to satisfy the Nyquist criteria (80 kHz which is limit for MATLAB). So there is no possibility to have an aliasing. What can be the problem? Thank you for any help. Here is my code:

K               = 1000; % kilo
sampling_freq   = 80*K; % 80KHz sampling for sin wave
sampling_period = sampling_freq^(-1);
f               = 20*K; %kilohertz
t               = 0:sampling_period:5; % 5 second sin signal
testing_sound   = sin(2*pi*f*t);
plot(t,testing_sound)
sound(testing_sound,sampling_freq);

• Why would you use something like 80 kHz, whereas 44.1 kHz is a standard value? Problem is most likely with your sound card. – jojek Feb 12 '15 at 12:16
• I tried 44.1KHz before. To control where the problem is I use 80KHz. – toygan kılıç Feb 12 '15 at 12:20
• But why? Try with 1kHz, 10kHz, 15kHz, 20kHz @ 44.1kHz and you should hear (or not, depending on hardware) the sinusoid. Drop the idea of 80kHz for now. – jojek Feb 12 '15 at 12:23
• I used 44.1KHz for the frequencies between 0Hz and 22KHz and I can hear all of the frequencies. The reason for using 80KHz is just testing above frequencies 22KHz and I can hear again using 80KHz. – toygan kılıç Feb 12 '15 at 12:30
• First of all - don't use 80kHz (I don't know why you came up with this number as a limit for MATLAB, whereas it is 1e6 in fact) but something that is more reasonable and standarized, i.e. 96kHz (or 88.2kHz if you wish...). Another thing is that your sound card might not be able to serve such high sampling frequency. You should check that in playback options --> advanced tab and set it correctly. Last thing - you should drop using obsolete sound and use audioplayer - unless you use some ooold MATLB. – jojek Feb 12 '15 at 12:36

First of all - don't use 80kHz (I don't know why you came up with this number as a limit for MATLAB, whereas it is 1e6 in fact) but something that is more reasonable and standardized, i.e. 96kHz (or 88.2kHz if you wish...). Another thing is that your sound card might not be able to serve such high sampling frequency. You should check that in playback options --> Advanced tab and set it correctly. Last thing - you should drop using obsolete sound and use audioplayer - unless you use some ooold MATLAB.