Plot with respect to time, not samples

If I record me voice, using audiorecorder, for 2 seconds at a sampling frequency of 8,000 Hz, then I will have 16,000 values. If I plot this, the x-axis goes from 0 to 16,000 - How do I make the x-axis represent time in seconds, i.e., from 0 to 2 seconds instead of 0 to 16,000 samples?

 採用された回答

Aquatris
Aquatris 2018 年 7 月 21 日
編集済み: Aquatris 2018 年 7 月 21 日

2 投票

You define the time variable yourself. You know that you sample at 9 kHz so you know that between each sample there is 1/8000 seconds. So;
time = 0:1/Fs:16000/Fs-1/Fs;
Then to plot you do;
plot(time,data)
If you already measured the time as well, just use that variable.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAudio I/O and Waveform Generation についてさらに検索

質問済み:

2018 年 7 月 21 日

編集済み:

2018 年 7 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by