The question was;

Load the file sound1.wav (You would use MATLAB command ‘wavread’ to loadthis file. Use MATLAB help to learn the usage of ‘wavread’). This file contains a portion of speech waveform. Take the first 512 point the signal, plot the waveformand its magnitude spectrum.

%call it like question_8('sound1.wav')
function question_8(url)
[x,fs]=wavread(url);
new_x=x(1:512);
subplot(2,1,1);
stem(new_x);
title('The sampled sound signal');
xlabel('time'), ylabel('amplitude');
grid on;
hold on


subplot(2,1,2)
N=(fs/2)*linspace(-1,1,length(x));
stem(N,fftshift(abs(fft(new_x))));

title('Sampled signal at frequency-domain');
xlabel('frequency'), ylabel('amplitude');
grid on;
end