view m-toolbox/classes/@pzmodel/abcascade.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line source

% ABCASCADE Cascade two filters together to get a new filter.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: ABCASCADE Cascade two filters together to get a new filter.
%
% CALL:        [a,b] = abcascade(a1,b1,a2,b2)
%
% VERSION:     $Id: abcascade.m,v 1.3 2010/10/29 16:09:15 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [ao,bo] = abcascade(a1,b1,a2,b2)

  n = length(a1);
  m = length(a2);
  N = m+n-1;

  alpha = zeros(1, N);
  beta = zeros(1, N);

  for i=0:n-1
    for j=0:m-1
      alpha(i+j+1) = alpha(i+j+1) + a1(i+1)*a2(j+1);
      beta(i+j+1) = beta(i+j+1) + b1(i+1)*b2(j+1);
    end
  end

  ao = alpha;
  bo = beta;
end