git-svn-id: http://moon:8086/svn/matlab/trunk@157 801c6759-fa7c-4059-a304-17956f83a07c
27 lines
556 B
Matlab
Executable File
27 lines
556 B
Matlab
Executable File
function y = farrow(x, P, mu)
|
|
|
|
D = size(P);
|
|
N = D(1);
|
|
M = D(2);
|
|
|
|
% Partial filter responses
|
|
for pp=1:M,
|
|
hp(pp, :) = filter(P(1:N, pp), 1, x);
|
|
end;
|
|
|
|
h = hp';
|
|
% Combine
|
|
for k=1:length(x),
|
|
y(k) = horner(h(k,:), mu);
|
|
end;
|
|
|
|
function y = horner(a,x)
|
|
% Input a is the polynomial coefficient vector, x the value to be evaluated at.
|
|
% The output y is the evaluated polynomial and b the divided coefficient vector.
|
|
b(1) = a(1);
|
|
for i = 2:length(a)
|
|
b(i) = a(i)+x*b(i-1);
|
|
end
|
|
y = b(length(a));
|
|
b = b(1:length(b)-1);
|