pulse train with gaussian pulses in an irregular interval

7 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Mathieu NOE
Mathieu NOE am 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)

Weitere Antworten (1)

Paul
Paul am 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')
  3 Kommentare
Paul
Paul am 16 Sep. 2021
That's just the effect of how the pulses interact with each other when one pulse starts before the previous one damps out. We can see from the first pulse that the fundamental pulse takes about 0.2 seconds to damp out. But the leading edge of pulses 2 and 3 are only about 0.04 seconds part, so they will interefere with each other, either constructively or destructively as the case may be. Think of the limiting case where two pulses start at the exact same time. The fourth pulse is spearated enough in time such that it looks just like the first.
Ioannis Matthaiou
Ioannis Matthaiou am 16 Sep. 2021
Thanks for clarifying that.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by