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 24, 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.

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!