# pulse train with gaussian pulses in an irregular interval

6 views (last 30 days)
Ioannis Matthaiou on 14 Sep 2021
Commented: Ioannis Matthaiou on 16 Sep 2021
Hello, I would like to generate a pulse train using Gaussian pulses where the time interval between each pulse is a random variable vector, say X. I know how to do the fixed time interval using pulstran.m and after specifying the prototype pulse using gauspuls.m. However, the irregular seems to be not that straightforward. Any help will be appreciated.

Mathieu NOE on 15 Sep 2021
hello
a quick and dirty demo , not using gauspuls but that could be easily done also
clc
clearvars
f0 = 50; % pulse frequency
Var_Sq = 1; % pulse variance (squared)
Fs = 20*f0;
dt = 1/Fs;
samples = Fs;
t = dt*(0:samples-1)';
t_mid = max(t)/2;
signal_all = [];
N = 25; % number of pulses generated
offset = 1.75*t_mid*(rand(N,1)-0.5); % random delay (spanned to the 75% of the max t value)
for ci =1:N
signal2 = exp(-(((t-t_mid-offset(ci)).^2).*((f0)^2))./(Var_Sq));
signal_all = [signal_all;signal2];
figure(1), % just to show the individual gaussian pulses with different time offsets
hold on
plot(t,signal2);
end
% now all samples are concatenated to make one signal with random delta t
% between pulses
figure(2),
plot(signal_all)
##### 2 CommentsShowHide 1 older comment
Mathieu NOE on 15 Sep 2021
my pleasure !

Paul on 15 Sep 2021
Can't the d input to pulstran be set to whatever offsets you want, random or otherwise? Taking the example from the pulstran docpage
fnx = @(x,fn) sin(2*pi*fn*x).*exp(-fn*abs(x));
ffs = 1000;
tp = 0:1/ffs:1;
pp = fnx(tp,30);
fs = 2e3;
t = 0:1/fs:1.2;
d = sort(rand(1,4)) % random offsets
d = 1×4
0.0035 0.5865 0.6244 0.9692
z = pulstran(t,d,pp,ffs);
plot(t,z)
xlabel('Time (s)')
ylabel('Waveform') Ioannis Matthaiou on 16 Sep 2021
Thanks for clarifying that.