Adding duration in second as x axis

1 回表示 (過去 30 日間)
masnoob
masnoob 2018 年 6 月 10 日
コメント済み: masnoob 2018 年 6 月 11 日
I have recorded and saved the sound signal and now would like to recreate the plot same as displayed using dsp.timeScope object.
plot(duration,data)
I have tried duration = start:step:end but it ended up having an extra 1 more data point in duration.(Must start with 0 not 1) Is there anyway to overcome this problem? Sampling rate is 44100Hz

採用された回答

dpb
dpb 2018 年 6 月 10 日
Don't alias the builtin duration; that will create problems working with time objects.
You don't really want a duration, you just want sampled time.
dt=1000/44100; % sampling time, ms
N=(length(data); % number samples in record
T=(length(data)-1)*dt; % sample time, ms
t=linspace(0,T,N); % make the time vector match the size of the data stream
plot(t,data) % plot, axis will be in msec; adjust xlim, xtick as wanted
If you really, really wanted to use one of the fancier ML features, use a timeseries
  1 件のコメント
masnoob
masnoob 2018 年 6 月 11 日
Thanks a lot !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by