gaussian chirp signal generation
7 views (last 30 days)
Show older comments
Hello.
i want to generate gaussian chirp( bidirectional ) signal , so i write below code. but I dont know why chirp signal plot is not as other chirp signals ! is there any problem with chirp signal codes?
Is any one could look at my codes and possibly help me to improve it?
clear all
clc
%----------------------------------------------------------------------------------------
%chirp signal generation
fs=1.5e6;
t = 0:1/fs:20.5e-3;
f0=29.25e6; f1=30.75e6; t1=20.5e-3;
y1 = chirp(t,f0,t1,f1,'linear');
y2=chirp(t,f1,t1,f0,'linear');
Y = [y1 y2];
time=0:1/fs:41.001e-3;
figure; plot(time,Y); title('Bidirectional chirp signal ');
xlabel('Time(s)'); ylabel('Amplitude');
%----------------------------------------------------------------------------------------
%gaussian signal generation
sigma=4.1e-3;
t1=-20.5e-3:1/fs:20.501e-3;
variance=sigma^2;
w=1/(sqrt(2*pi*variance))*(exp(-t1.^2/(2*variance)));
figure; plot(t1,w,'b'); title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);
xlabel('Time(s)'); ylabel('Amplitude');
%----------------------------------------------------------------------------------------
%gaussian chirp signal
xw = w .* Y;
figure; plot(time,abs(xw));
xlabel('Time(s)'); ylabel('Amplitude');
title(['gaussian bidirectional chirp signal']);
2 Comments
Rana Adel Abdelaleim
on 29 Sep 2021
Majid
can I ask how do you choose your intial and final frequencies corresponding to the sample frequency since you wrote 29.25MHz and 30.75MHz and when ever i try to use it for different range of frquencis it is not working.
Thanks
Rana
Answers (2)
Mathieu NOE
on 31 May 2021
hello Maj
I fixed your code and improve a bit the x axis time display (all plots are centered around t = 0 )
the major problem is that you frequencies are above the sampling frequency fs which is incorrect (see Shannon's theorem)
just to make the plot easy to read (and to show that the gaussian chirp is now symmetrical around t = 0) , I lowered your f0 and f1 frequencies quite significantly; you can put back the right values but keep in mind fs > 2 * f1 at least !
second issue is when you want to generate y2 (the time mirrored version of y1) is not really doing what you expected; there's a simpler method , see the code below
clear all
clc
%----------------------------------------------------------------------------------------
%chirp signal generation
fs=1.5e6;
t = 0:1/fs:20.5e-3;
f0=29.25e0; f1=30.75e1; t1=20.5e-3; % lowered frequencies to show sampling problem
% f0=29.25e6; f1=30.75e6; t1=20.5e-3; % original frequencies are above
% fs which is not possible !!
y1 = chirp(t,f0,t1,f1,'linear');
% y2 = chirp(t,f1,t1,f0,'linear'); % is not the time mirrored version of y1 !
% Y = [y1 y2];
Y = [y1 y1(end:-1:1)]; % y1(end:-1:1) is the time mirrored version of y1, without need to call chirp function again
t1=-20.5e-3:1/fs:20.501e-3;
figure; plot(t1,Y); title('Bidirectional chirp signal ');
xlabel('Time(s)'); ylabel('Amplitude');
%----------------------------------------------------------------------------------------
%gaussian signal generation
sigma=4.1e-3;
% t1=-20.5e-3:1/fs:20.501e-3;
variance=sigma^2;
w=1/(sqrt(2*pi*variance))*(exp(-t1.^2/(2*variance)));
figure; plot(t1,w,'b'); title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);
xlabel('Time(s)'); ylabel('Amplitude');
%----------------------------------------------------------------------------------------
%gaussian chirp signal
xw = w .* Y;
% figure; plot(time,abs(xw));
figure; plot(t1,abs(xw)); % why the abs() ?
xlabel('Time(s)'); ylabel('Amplitude');
title(['gaussian bidirectional chirp signal']);
2 Comments
Mathieu NOE
on 31 May 2021
hello
sorry , at first look I don't see the connection between what we discussed above and the new data
i's a different topic ?
majid
on 31 May 2021
3 Comments
Mathieu NOE
on 31 May 2021
hello again
when you say "my problem is that, I'm not OK with this chirp signal plot, beacause it doesn't looks like other chirp signals." what do you consider the "good" chirp signal ?
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!