Edited: Changed code to a more correct version!
The question was;
Load the file sound1.wav(Download from here => SoundWav (176) ) (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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | %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 |







