Reputation: 3870
Consider this short code:
fc=2e9;
fs = 100e9;
for n=1:2
tc = gmonopuls('cutoff',fc);
t{n} = -2*tc:1/fs:2*tc;
y{n} = gmonopuls(t{n}+n*5e-11,fc);
fc=fc+5e3;
end
plot(t{1},y{1},'r',t{2},y{2},'k')
It generates a two Gaussian mono-pulses shifted by a slight amount:
My problem is this: How do I make this symmetric? Note how the tails match up...they are zero for both the red and black pulse. I am new to the signal processing toolbox in matlab and want to modify the code below to have matched heads too.
Upvotes: 1
Views: 162
Reputation: 14577
gmonopuls
computes a Gaussian pulse which is centered at 0:
t = -2*tc:1/fs:2*tc;
y = gmonopuls(t,fc);
plot(t, y, 'k');
Evaluating this function at different time instants does not change the fundamental shape of the curve. It would only change which part of the curve you are sampling:
K = 2*tc;
for n=1:3
t{n} = -2*tc:1/fs:2*tc + (n-2)*K;
y{n} = gmonopuls(t{n},fc);
end
plot(t{1},y{1},'rx', t{2},y{2},'k', t{3},y{3},'bs');
legend('t-K','t','t+K');
To obtain a curve shifted along the time axis you simply need to add a time offset after you have computed your function:
for n=1:2
tc = gmonopuls('cutoff',fc);
t{n} = -2*tc:1/fs:2*tc;
y{n} = gmonopuls(t{n},fc);
t{n} = t{n} - n*5e-11;
fc=fc+5e3;
end
plot(t{1},y{1},'r',t{2},y{2},'k')
Upvotes: 2