关于子带编码和延迟信号的编码 我的代码:
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))]
但我收到错误
==>中的错误40 w13处的八度子带= [零(大小(1:N-1))v3(1:长度(v3) - (N-1))]; %插入延迟z ^( - (N - ))
我不知道修复它。请帮我。感谢
答案 0 :(得分:1)
它首先要查看您要连接的数组的大小:
>> size(v3(1:length(v3)-(N-1)))
ans =
2483 1
>> size(zeros(size(1:N-1)))
ans =
1 17
建议你需要转置其中一个:
w13= [zeros(size(1:N-1))'; v3(1:length(v3)-(N-1))];
或
w13= [zeros(size(1:N-1)) v3(1:length(v3)-(N-1))'];