How do I make the x-axis of a signal to represent time?

4 Ansichten (letzte 30 Tage)
Ahmed Elaraby
Ahmed Elaraby am 22 Jun. 2021
Kommentiert: Ahmed Elaraby am 22 Jun. 2021
So I'm trying to plot a graph with the time as the x-axis, but I'm having a hard time trying to.
This is my code so far:
load handel.mat
filename = 'handel.wav';
audiowrite(filename,y,Fs);
clear y Fs
[y,Fs] = audioread('handel.wav');
plot(y);
xlabel 'Time'
ylabel 'Audio signal'
I'm still new to MATLAB so it's still not easy for me.
Thanks in advance

Akzeptierte Antwort

Chunru
Chunru am 22 Jun. 2021
t=(0:length(y)-1)/fs;
plot(t, y);

Weitere Antworten (0)

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by