主题:[讨论]大問題
程式
function [y] = my_ola_filter(x, h, N) %function of overlap add method
% x=input sequence
% h=impulse response
% N=blocksize
Lenx = length(x); M= length(h);% length of x & lenght of h
N1 = N+M-1;
m=rem(Lenx,N); %find remainder
if m~=0
x=[x zeros(1,N-m)]; % preappend (M-1) zeros
K=floor(Lenx/N)+1; % number of blocks
else
x=x;K=floor(Lenx/N);
end
ytemp=zeros(1, N1-N);
n1=1; n2=N;
for k=1:K %convolution with succesive blocks
xk=x(n1:n2);
Y(k,=circonvt(xk, h, N1); % recall circonvt function
for i=1:N1-N
Y(k,i)=Y(k,i)+ytemp(i);
ytemp(i)=Y(k,i+N);
end
y(n1:n2)=Y(k,1:N);
n1=n1+N; n2=n2+N;
end
我用->
>> y=my_ola_filter(x, h, N)
[bo]??? Error using ==> horzcat
CAT arguments dimensions are not consistent.
Error in ==> my_ola_filter at 9
x=[x zeros(1,N-m)]; % preappend (M-1) zeros[/bo]
>>
如何解決????????
謝謝!!!!!
function [y] = my_ola_filter(x, h, N) %function of overlap add method
% x=input sequence
% h=impulse response
% N=blocksize
Lenx = length(x); M= length(h);% length of x & lenght of h
N1 = N+M-1;
m=rem(Lenx,N); %find remainder
if m~=0
x=[x zeros(1,N-m)]; % preappend (M-1) zeros
K=floor(Lenx/N)+1; % number of blocks
else
x=x;K=floor(Lenx/N);
end
ytemp=zeros(1, N1-N);
n1=1; n2=N;
for k=1:K %convolution with succesive blocks
xk=x(n1:n2);
Y(k,=circonvt(xk, h, N1); % recall circonvt function
for i=1:N1-N
Y(k,i)=Y(k,i)+ytemp(i);
ytemp(i)=Y(k,i+N);
end
y(n1:n2)=Y(k,1:N);
n1=n1+N; n2=n2+N;
end
我用->
>> y=my_ola_filter(x, h, N)
[bo]??? Error using ==> horzcat
CAT arguments dimensions are not consistent.
Error in ==> my_ola_filter at 9
x=[x zeros(1,N-m)]; % preappend (M-1) zeros[/bo]
>>
如何解決????????
謝謝!!!!!