how to resolve "matrix dimension exceeded "error?

조회 수: 1 (최근 30일)
vivek sharma
vivek sharma 2015년 10월 15일
편집: Walter Roberson 2015년 10월 15일
please suggest me how to resolve this error in mfcc process-
z=log(H1*(w1(39:K-1)).*conj(w1(39:K-1)));
??? Index exceeds matrix dimensions.
my program is
close all;
clear all;
clc;
%%%%%%%%%%%%%sample read%%%%%%%%%%%%
fs=16000; %sampling frequency, in 1 second take 16000 samples
[s1,f,nbit]=wavread('t on.wav');%read sample 1
[s2,f,nbit]=wavread('t off.wav');%read sample 2
[s3,f,nbit]=wavread('f on.wav');%read sample 3
[s4,f,nbit]=wavread('f off.wav');%read sample 4
%%%%%%%%%%%%%%%%%%%preemphasis%%%%%%%%%%%%%%
B = [1 0.95];
r1 = filter(B,1,s1);
r2 = filter(B,1,s2);
r3 = filter(B,1,s3);
r4 = filter(B,1,s4);
%%%%%%%%%%%%%%windowing,framing and fft%%%%%%%%%%%%
r5=resample(r1,16000,f);
r6=resample(r2,16000,f);
r7=resample(r3,16000,f);
r8=resample(r4,16000,f);
SegmentStep=fs*.02;
noverlap=fs*.025;
framelength=SegmentStep+noverlap ;
nfft=length(r5);
nsegments=floor(nfft/(SegmentStep))-1;
w1=specgram(r5,hamming(framelength),noverlap,nfft,fs);
w2=specgram(r6,hamming(framelength),noverlap,nfft,fs);
w3=specgram(r7,hamming(framelength),noverlap,nfft,fs);
w4=specgram(r8,hamming(framelength),noverlap,nfft,fs);
lfft = 2^12; % fft size (number of frequency bins)
K = lfft/2+1; % length of each filter
M = 40; % number of filters
hz2mel = @(hz)(1127*log(1+hz/700)); % Hertz to mel warping function
mel2hz = @(mel)(700*exp(mel/1127)-700); % mel to Hertz warping function
% Design mel filterbank of M filters each K coefficients long,
% filters are uniformly spaced on the mel scale between 0 and Fs/2 Hz
[ H1, freq ] = trifbank( M, K, [300 fs/2], fs, hz2mel, mel2hz );
figure
plot( freq, H1 );
xlabel( 'Frequency (Hz)' ); ylabel( 'Weight' ); set( gca, 'box', 'off' );
z=log(H1*(w1(40:K)).*conj(w1(40:K)));
please also suggest me next steps to complete this mfcc process
  댓글 수: 1
dpb
dpb 2015년 10월 15일
Use code button to format code legibly...
But, set breakpoint and see what are
length(w1)
and
K % ?
K must be <= length(w1)
It appears K will be 2048; too hard to try to parse to figure out what size(w1) might be.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Feature Extraction에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by