How can I plot a comb function?

Illustration
suketu vaidya - 2022-09-27T09:22:16+00:00
Question: How can I plot a comb function?

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 answered . 2025-11-20

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.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!