Vectors must be the same length.
조회 수: 9 (최근 30일)
이전 댓글 표시
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
Nitin Phadkule
2021년 7월 4일
size of t and y must be same i.e. number of values in array t and y must be equal
Mathieu NOE
2021년 7월 4일
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
답변 (1개)
Sulaymon Eshkabilov
2021년 7월 4일
편집: Sulaymon Eshkabilov
2021년 7월 4일
A small err in t's size:
...
t = t(1:end-1); % 1 last value has to be removed.
...
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!