MATLAB: How can I generate a sequence of sinc pulses corresponding to a given sequence.like for 1 plot positive sinc and for 0 plot negative but in sequence and on same plot

sinc pulse

t=-5:.001:5; x = randsrc(1,200,[1,-1,; .5,.5]); n=length(x); w=0.5; p=sinc(2*w*t); q=-sinc(2*w*t); for i=1:n if x(i)==1 plot(p) else plot(q) i=i+1; end j=j+1; end

Best Answer

t=-5:.001:5;
x = randsrc(1,200,[1,-1,; .5,.5]);
n=length(x);
w=0.5;
p=sinc(2*w*t);
figure
hold on
for ii=1:n
plot(t,p*x(ii))
t=t+10;
end