%%%%%%%%%%%%%%%%%%%%
%
%    dilatrandn.m
%
%%%%%%%%%%%%%%%%%%%%
%
% Used in IDCnoise.m
%
% Builds an NLxNC array of normal random variable with mean mu and variance
% sigma2 where mu and sigma2 may be vectors.
%
% [X] = dilatrandn(mu,sigma2,NL,NC);


function [X] = dilatrandn(mu,sigma2,NL,NC);

if nargin<3
	[NL,NC] = size(mu);
end
	
if max(NL,NC)>1
	if length(mu)==1
		mu = mu*ones(NL,NC) ;
	end
	if length(sigma2)==1
		sigma2 = sigma2*ones(NL,NC) ;
	end
end

X = mu + sqrt(sigma2).*randn(NL,NC) ;
