How to unfold (spread) vector?

조회 수: 3 (최근 30일)
David Hatle
David Hatle 2016년 5월 3일
댓글: David Hatle 2016년 5월 3일
Hello I have a problem while analysing speech. I am trying to detect pauses. I have calculated envelope of the energy of the signal and autocorrelation of the signal. I have two borders - f and 500 that I am comparing them in code below:
for i = 1:length(speech)
if env_energy(i) == f && corr(i) < 500
%do something
end
end
The problem is that env_energy has 1557230 samples and corr only 648 samples. Can you tell me how to spread corr vector so that it doesn´t exceed matrix dimensions in for loop? Thank you

채택된 답변

CS Researcher
CS Researcher 2016년 5월 3일
편집: CS Researcher 2016년 5월 3일
You can use interp1. Try this:
newRange = linspace(1, numel(corr), numel(env_energy));
newCorr = interp1(1:numel(corr),corr,newRange);
Hope this helps!
  댓글 수: 1
David Hatle
David Hatle 2016년 5월 3일
It works great! Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulation, Tuning, and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by