MATLAB: How to generate a non periodic Chirp signal

code:
clear all
clc
fs = 150000;
ts = 1/fs;
tpuls = 10e-3;% chirp_with
f1 = 94;
f2 = 9000;
N= 20;% number of my chirp
t=0:ts:tpuls; % ungerade zahl endet auf null/t=0:ts:tpuls;
y = chirp(t, f1, t(end), f2);
plot(t, y, 'b*-');
grid on;
% example is a attached document

Best Answer

Hallo Herr Müller
1. my preferred way to generate signal 'trains' is with command repmat
clear all
fs = 150000; ts = 1/fs; tpuls = 10e-3;% chirp_with

f0 = 94; f2 = 9000; N= 20;% number of my chirp

t=0:ts:tpuls; % ungerade zahl endet auf null/t=0:ts:tpuls;

y = chirp(t, f0, t(end), f2);
figure(1);plot(t, y); grid on;
t2=repmat(t,1,2);
t_guard=zeros(1,300);
y0=[y t_guard]; % daß ist deine y
y2=repmat(y0,1,3);
figure(2);plot(y2);grid on
2.
the function pulstran is also suggested by Mathworks support in
but
  • pulstran only has 3 predefined functions, if one needs a custom function, as it happens in most of the cases, a handle to the custom function, or the same anonymously defined function has to be passed to repmat instead.
  • you need 2 time vectors, one for the base chirp, and an extended one for the resulting signal.
Following an example with pulstran and custom function:
fs = 150000; ts = 1/fs; tpuls = 10e-3;% chirp_with
f0 = 94; f2 = 9000; N= 20;% number of my chirp
t=[0:ts:tpuls]; % ungerade zahl endet auf null/t=0:ts:tpuls;
y = chirp(t, f0, t(end), f2);
figure(1);plot(t, y); grid on;
T = 0:1/fs:3-1/fs;
prf = 1; pw = 0.1;
D = 0:1/prf:3-1/prf;
Y = pulstran(T,D,@(t)chirp(t,f0,t(end),f2).*(t>=0).*(t<pw));
figure(2);plot(T,Y);grid on
you may also want to modify f0 and f2 passed to pulstran by a factor N
T = 0:1/fs:3-1/fs;
prf = 1; pw = 0.4;
D = 0:1/prf:3-1/prf;
N=12; % decimation needed to keep same frequencies
Y = pulstran(T,D,@(t)chirp(t,f0/N,t(end),f2/N).*(t>=0).*(t<pw));
figure(3);plot(T,Y);grid on
.
note that there is a slight variation in the top frequency of the last pulse compared to the first pulse.
Function pulstran is useful but requires a more elaborate configuration than repmat as shown above, and the simplicity of using only one time vector may also pay off avoiding complications.
3.
you can vary the intervals between chirped pulses either modifying the guard interval from the simple sequence of zeros to diverse lengths when using repmat, or with the parameter D in pulstran
So Herrn Müller
if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
Servus und thanks in advance
John BG