How can I plot a comb function?

S
suketu vaidya · Sep 27, 2022 · 2.4K views
Question
Hello,   A comb function is an array of delta functions spaced equally. I want to plot a function like this. F(x)= comb(2x)*sinc(50x).sinc^2(x). I could manage the sinc and the sinc^2. But I don't understand how I can plot the comb function which is a summation of deltas from -inf to +inf
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 16, 2026

You can simply create a discrete-time (Kronecker delta) impulse and repeat that. For example:

 x = 0:(2*pi)/1000:pi-(2*pi)/1000;
 diraccomb = zeros(size(x));
 diraccomb(1) = 1;
 diraccomb = repmat(diraccomb,1,10);
 xnew = 0:(2*pi)/1000:(5000*(2*pi)/1000)-(2*pi)/1000;

The above is a Dirac comb spaced at pi. You can easily modify for any sampling grid or period.

Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!