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

6 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by