I got this message whilst trying to build a program in Matlab:
Error:
Subscript indices must either be real positive integers or logicals.
Error in Untitled (line 17)
x(pocz:kon) = x(pocz:kon) .* H;
I know that the index is wrong but i do not know how should it be. Could anyone help me ?
Here is the code:
clc;
[x, fs, Nbits] = wavread('zero.wav'); % x -> data sampling | fs -> sampling freq | Nbits -> bits per sample
subplot(2,1,1); plot(x); title('asd');
N = length(x); %
HamWin = 240; % size of Hamming Window
ShiftHamWin = 180; % shift of Hamming windwow
Frames = N/ShiftHamWin; %
%1. PREEMFAZA
x = filter([1 -0.9735], 1, x);
%----------------------------------------------------------------
%2. OKNO
%x = x - mean(x);
beg= 0;
en = 180;
H = hamming(HamWin);
while(beg < N)
x(beg:en) = x(beg:en) .* H;
beg = round(en);
en = round(en + 180);
end;
%-----------------------------------------------------------------
subplot(2,1,2); plot(x);