0

I code about subband coding, and delay signal My code:

N = 18; %Setting the filter length
[h0,h1,g0,g1] = firpr2chfb(N-1,0.4); % MATLAB function for the analysis/synthesis       
num=20000;
[x,fs,nbits] = wavread('sub1.wav',num);
% Analysis part
% Level 1
x0 = filter(h0,1,x); % Lowpass filtering
x1 = filter(h1,1,x); % Highpass filtering 
v0 = downsample(x0,2); % Down-sampling, signal component v_0[n]
v1= downsample(x1,2); % Down-sampling, signal component v_1[n]
% Level 2
x2= v0; % Selecting the lowpass output from Level for the input to Level 
x02 = filter(h0,1,x2); % Lowpass filtering
x12 = filter(h1,1,x2); % Lowpass filtering
v02= downsample(x02,2); % Down-sampling
v12= downsample(x12,2); % Down-sampling
v2= v12; % Signal component v_2[n]
% Level 3
x3= v02; % Selecting the lowpass output from Level for the input to Level 
x03 = filter(h0,1,x3); % Lowpass filtering
x13 = filter(h1,1,x3); % Highpass filtering
v03= downsample(x03,2); % Down-sampling
v13= downsample(x13,2); % Down-sampling
v3= v13; % Signal component v_3[n]
w13= [zeros(size(1:N-1)) v3(1:length(v3)-(N-1))]

But I receive a error

Error in ==> octavesubband at 40 w13= [zeros(size(1:N-1))v3(1:length(v3)-(N-1))]; %Inserting the delay z^(-(N-))

I don't know fix it. Please help me. Thanks

1 Answer 1

1

well it starts by looking at the size of the array you are trying to concatenate:

>> size(v3(1:length(v3)-(N-1)))

ans =

        2483           1

>> size(zeros(size(1:N-1)))

ans =

     1    17

Which suggest you need to transpose one of them:

w13= [zeros(size(1:N-1))'; v3(1:length(v3)-(N-1))];

or

w13= [zeros(size(1:N-1)) v3(1:length(v3)-(N-1))'];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.