How to plot WAV file

J
john_smith45 · Dec 13, 2021 · 2K views
Question
Hello,   I'd like to plot .wav file in time and frequency domain.
Expert Answer
Profile picture of John Williams
John Williams PhD Expert
Answered Aug 25, 2026
If this is the output of wavread, then see if you have two channels in y
 
[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)));

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!