MATLAB Answers

pulse train with gaussian pulses in an irregular interval

조회 수: 5(최근 30일)
Ioannis Matthaiou
Ioannis Matthaiou 2021년 9월 14일
댓글: Ioannis Matthaiou 2021년 9월 16일
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
Mathieu NOE 2021년 9월 15일
a quick and dirty demo , not using gauspuls but that could be easily done also
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
% now all samples are concatenated to make one signal with random delta t
% between pulses

추가 답변(1개)

Paul 2021년 9월 15일
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);
xlabel('Time (s)')
  댓글 수: 3
Ioannis Matthaiou
Ioannis Matthaiou 2021년 9월 16일
Thanks for clarifying that.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by