zerohold.m

来自「CDMA系统的完整仿真程序,供大家参考.」· M 代码 · 共 24 行

M
24
字号
function Y=zerohold(X,N)
%ZEROHOLD Oversample the input X, by N times, using zero order hold.
%	  Y=zerohold(X,N)
%	  If X is a matrix then each row is over sampled
%	  Copyright (c) Eric Lawrey July 1997

%Modifications:
%	10/7/97	Started writing the function. This function is finished
%		and tested. It appears to work.
if N > 0,
	if N > 1,
		N = round(N);
		Y = zeros(size(X,1),size(X,2)*N);	%initialize Y

%		for k = 1:size(X,2)*N
%			Y(:,k) = X(:,ceil(k/N));	%Copy multiple X values into Y
%		end
		for k = 1:N:size(X,2)*N,	%Copy multiple X values into Y
			Y(:,k:k+N-1)=X(:,ceil(k/N)).*ones(size(X,1),N);
		end
	else
		Y=X;
	end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?