Adding duration in second as x axis
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
dpb
am 10 Jun. 2018
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!