Adding duration in second as x axis
조회 수: 3 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!