# Undesirable zeros in sampled signal using train of impulses

I'm trying to analyze a signal like the example below, but it contains undesirable zero value samples, is there any way to eliminate them? I'm using Matlab.

Actually, the problem is this: in a sampling process I am using a train of impulses but that train I formed it with the cardinal sine function and it has generated values with zeros. Then, that train multiplies it in time to the sinusoidal signal and obtain samples (samples with zeros).

k=5;
t=0:Ts:T;
for n=min(t):k*Ts:max(t)
pdirac=pdirac+sinc(100*(t-n));
end
signal=signal1.*(pdirac);


• In its current form, this question is not properly answerable here. Either, it's really just "how do I ignore all but the Nth values in a matlab vector (or all but the nonzero values, or...)", in which case it's not a signal processing, but a plain programming question, and hence off-topic here (and would indicated you might want to spend a couple more minutes on a Matlab tutorial). Or, your question is related to some signal property, but then you forgot to even mention that, so your question is unclear. Mar 14, 2017 at 22:14
• Actually, the problem is this: in a sampling process I am using a train of impulses but that train I formed it with the cardinal sine function and it has generated values with zeros. Then, that train multiplies it in time to the sinusoidal signal and obtain samples (samples with zeros).
– Bkx
Mar 15, 2017 at 1:20
• If you can make certain guarantees on the frequency content of the signal prior to multiplying by the train of impulses, then you can cast this as an interpolation problem. Then, passing your signal through an appropriate interpolation filter will give you a meaningful result.
– hops
Mar 15, 2017 at 7:58
• Edit your question to include that info! Mar 15, 2017 at 8:51

If you just dont want to see them in your figure, just replace them with nans. Lets say that your signal is s. Then

s(s==0)=nan;
plot(s);

nz = 4;              % # zeros between samples
i1 = 1;              % index of first non-zero sample
y = x(i1:nz+1:end);  % signal without zeros in between samples