簡體   English   中英

錯誤的Matlab代碼

[英]Error Matlab 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))]

但是我收到一個錯誤

40 w13 ==> octavesubband中的錯誤= [zeros(size(1:N-1))v3(1:length(v3)-(N-1))]; %插入延遲z ^(-(N-))

我不知道解決它。 請幫我。 謝謝

首先,它着眼於您要連接的數組的大小:

>> 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))'];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM