No BSD License  

Highlights from
Signals & Systems: Continuous and Discrete, 4e Companion Software

from Signals & Systems: Continuous and Discrete, 4e Companion Software by Rodger Ziemer
Companion Software for Signals & Systems: Continuous and Discrete, 4e

cmb_fn(t,t_rep,t_width,delta)
%	cmb_fn(t,t_rep,t_width,delta).  This function generates a comb of unit impulses centered
%	at t = 0 spaced by t_rep and of total duration t_width.
%
function y = cmb_fn(t,t_rep,t_width,delta)
L = length(t);
N = round(t_width/t_rep+1);
y = zeros(size(t));
for n = 1:N
	y=y+impls_fn(t-(n-1)*t_rep+(N-1)*t_rep/2,delta);
end

Contact us at files@mathworks.com