% NGPROP is called by the function fromPzmodel
%
% Inputs calculated by ...
%  ... NGCONV:
%            - num:   numerator coefficients
%  ... NGSETUP:
%            - Tprop: matrix to calculate propagation vector
%            - E:     matrix to calculate propagation vector
%  ... NGINIT
%            - y:     initial state vector
%            - num:   numerator coefficients
%  ... USER
%            - ns:    number of samples given as input from the user
%  Outputs:
%            - x:     vector of timesamples
%            - y:     last calculated state vector (could be used as input
%                     for next LTPDA_NOISEGEN call)
% A Monsky 24-07-07
%
% $Id: ngprop.m,v 1.3 2008/10/20 08:38:29 anneke Exp $

function [x y] = ngprop(Tprop, E, num, y, ns)

  lengT = length(Tprop);
  lengb = lengT+1;

  num=num';
  num = [num zeros(1,(lengb-length(num)-1))];


  x = zeros(ns,1);
  for i=1:ns
    r = randn(lengT,1);
    y = E * y + Tprop * r;
    x(i) = num*y;
  end

end
