Assigning time points on X axis

조회 수: 9 (최근 30일)
Sonia Wiemann
Sonia Wiemann 2012년 4월 16일
I have a wav file imported as data points. I know the sampling rate is 44.1kHz per sec. I know that the file contains 18, 873 samples. How can I assign time on the x axis in msec?
  댓글 수: 1
Geoff
Geoff 2012년 4월 16일
http://www.mathworks.com.au/matlabcentral/answers/34874-assigning-time-on-x-axis-for-audio-samples

댓글을 달려면 로그인하십시오.

채택된 답변

Kye Taylor
Kye Taylor 2012년 4월 17일
If your sampling frequency is 44.1 kHz, then one millisecond comprises 44.1 time samples. So, if x represents the vector of 18,873 samples, the following yields integer values on the x-axis representing milliseconds, starting at time zero:
plot((0:length(x)-1)/44.1, x)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by