Vectors must be the same length.
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mohammad Asadul Islam sazid
el 4 de Jul. de 2021
Editada: Sulaymon Eshkabilov
el 4 de Jul. de 2021
Every time I run this code, I get "Error using plot Vectors must be the same length.
Showing error in line-8.
reading the audio input signal
[y, Fs] = audioread('recording for lab.wav')
x = resample(y, 8000, 44100);
info = audioinfo('recording for lab.wav')
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end);
figure()
subplot(1,1,1)
plot(t,y)
xlabel('time')
ylabel('amplitude')
title('audio signal')
3 comentarios
Nitin Phadkule
el 4 de Jul. de 2021
size of t and y must be same i.e. number of values in array t and y must be equal
Mathieu NOE
el 4 de Jul. de 2021
hello ,
You are not using Fs info to generate the time stamps (uh !) , and even worse you do a resampling function and do not apply the implication on Fs (that then would generate the right t vector)
so no wonder signal and time vector are of different length
Respuestas (1)
Sulaymon Eshkabilov
el 4 de Jul. de 2021
Editada: Sulaymon Eshkabilov
el 4 de Jul. de 2021
A small err in t's size:
...
t = t(1:end-1); % 1 last value has to be removed.
...
0 comentarios
Ver también
Categorías
Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!