How will i solve this problem? "Index exceeds matrix dimensions". i am not sure which line corresponds to the error can anyone help me?
Show older comments
I am trying to execute this part of the program to calculate H
Under this condition,
if nfft21 ~= length(Y)
error('Error: input spectrum length is wrong');
end
f0Bins = (ceil(f0range(1)*nfft/fs+1) : floor(f0range(2)*nfft/fs+1));
forange is the pitch freq of the signal , dimension is (nfft/2+1) x 1 for my signal forange[100 300]
Y is the stft of a noisy signal
Q is the number of harmonic bands chosen 12
nfft i have chosen to be 512
nfft21= (nfft/(2+1))
ff = (0:nfft-1)*fs/nfft;
fband = floor((f0bin-1)/2);
H = zeros(nfft21,1);
A = zeros(Q,1);
aq2bq = zeros(Q,2*fband+1);
for q = 1:Q
aq2bq(q,:) = q*(f0bin-1)+1-fband : q*(f0bin-1)+1+fband;
numerator = sum( Y(aq2bq(q,:)).'.*conj(E(aq2bq(q,:))) );
denominator = sum( abs(E(aq2bq(q,:))).^2 );
A(q) = numerator/denominator;
H(aq2bq(q,:)) = A(q)*ones(2*fband+1,1);
end
i am not sure which line corresponds to the error can anyone help me? Thanks in advance
2 Comments
David Sanchez
on 23 Oct 2014
What values are you giving to nfft21, fband and Q ?
David Sanchez
on 23 Oct 2014
and f0bin? Who is Y ?
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!