Hello, I'd like to plot .wav file in time and frequency domain.
John Williams answered .
2025-11-20
[y,fs] = wavread(filename);
If y is two-channels, Nx2, then just plot one:
y = y(:,1);
dt = 1/fs;
t = 0:dt:(length(y)*dt)-dt;
plot(t,y); xlabel('Seconds'); ylabel('Amplitude');
figure
plot(psd(spectrum.periodogram,y,'Fs',fs,'NFFT',length(y)));