Spectrogram of Audio Signal

161 views (last 30 days)
Hello,
I have a audio Signal , and have to plot the spectrogram of that Signal.
After coding, I have Fs=44100 and Sound signal= 448064*1
How can I plot this as both the matrix size does not match.
Please help me out
Thanks in Advance
clc;
clear all;
close all;
[y,Fs]= audioread('1kdrei.wav');
dt=1/Fs;
y_1= y(:,1);
win=hamming(512);
windowsize=256;

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 30 Jul 2021
Have a look at the help and documentation of the spectrogram function. That allows you to calculate the spectrogram as such:
[S,F,T] = spectrogram(y(:,1),windowsize,windowsize/4,[],Fs);
Then you can plot the spectrogram using pcolor:
pcolor(T,F,log10(abs(S))),shading flat,colorbar
HTH

More Answers (0)

Categories

Find more on Time-Frequency Analysis in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!