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

조회 수: 4 (최근 30일)
Ahmed Elaraby
Ahmed Elaraby 2021년 6월 22일
댓글: Ahmed Elaraby 2021년 6월 22일
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