Time axis explanation required
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I am recording my 3 seconds voice signal to plot it in a graph. But the time axis in the graph seem strange. I am recording 3 second audio so to my understanding time axis should be from 0-3 but it shows values in [x10^5]. I asked another question here and foud out the code that plots the x axis but I cannot undeerstand how is it being plotted. Here's my code:
fs = 48000;
rec1 = audiorecorder(fs,16,1);
recordblocking(rec1, 3);
myRec1 = getaudiodata(rec1);
time = length(myRec1)/fs
ti = 0:time:(length(myRec1)*time)-time;
axes(handles.orignal)
plot(ti,myRec1)
If I write:
plot(time,myRec1)
it does not plot saying vectors must be of same length. So can anyone explain to me how is this line working
ti = 0:time:(length(myRec1)*time)-time;
I mean like how is it values in [x10^5] and not 0-3 in the x axis?
0 commentaires
Réponses (1)
David Goodmanson
le 7 Juin 2020
Hi Saad,
'time' is (almost) the total length of the time record, so it will not be the spacing when setting up the time array. Try
time = (length(myRec1)-1)/fs
timearray = linspace(0,time,length(myRec1))
0 commentaires
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!