Importing wav files in MATLAB

Thread Starter

Nanophotonics

Joined Apr 2, 2009
383
Hello,

I've imported a wav file into MATLAB as below: -

[X Fs nbits] = wavread ('file directory');

subplot(2,1,1);plot(X);
title('X(t)');
xlabel('Time (s)');
ylabel('Amplitude (V)');
grid on;

subplot(2,1,2);plot((abs(fft(X))));
title('X(f)');
xlabel('Frequency (Hz)');
ylabel('Power Spectral Density');
grid on;
How would I know if MATLAB is plotting the right length of time, frequency and PSD? Also I would like to prevent MATLAB from plotting the negative frequencies.

Thanks
 
Last edited:
Top