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);
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.