function ZZ = StationaryGaussProcess(Msteps,Lam2TStep,corshape)
%StationaryGaussProcess Provide sequential  values  of Stationary Gaussian Random Process.
%   ZZ = StationaryGaussProcess(Msteps,Lam2TStep,corshape) returns 
%   the (Msteps,size(Lam2TStep,1))-matrix of values at sequential time moments)
%   assuming  Mean=0,Sigma=1 and Lam2TStep is 1-column vector
%   with non-negative entries
%   Input argument corshape  must be either "exponent" or "gaussian" that means
%   exp(-t/lambda) or exp(-t^2/(2*lambda))
%   author: Andrey Khokhlov. 
%   $Revision: 0.25 $  $Date: 2011/09/05 16:15:33 $

if  size(Lam2TStep,2) ~= 1  
    error('MATLAB:StationaryGaussProcess:InvalidInput', 'second input argument must be (Nx1)-column.')
end
if Lam2TStep ~= abs(Lam2TStep)   
    error('MATLAB:StationaryGaussProcess:InvalidInput', 'Input argument Lam2TStep must non-negative.')
end


NCols=size(Lam2TStep,1);
ZZ=zeros(Msteps,NCols);

for kk=1:NCols
    lambda2TimeStep=Lam2TStep(kk);
    TstArr=ZZ(:,kk);
    [XX, MM, DeltaT]=AutoCorrWeights(lambda2TimeStep,corshape);
    LL=size(XX,1);    
    ArrBase=randn(1,LL);
    for ii=1:Msteps
        ZZ(ii,kk)=ArrBase*XX;
        ArrBase=circshift(ArrBase,[0,-MM]);
        ArrBase(LL-MM+1:LL)=randn(1,MM);
    end
    
end
return

