gaussian chirp signal generation

20 次查看(过去 30 天)
majid
majid 2021-5-30
评论: majid 2021-9-29
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 个评论
Rana Adel Abdelaleim
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
majid
majid 2021-9-29
Hello,
I choosed the initial frequency and final frequency Based on one of my work article.
But, since the freqency is very high you cant see chirp signal and you shoud zoom in enough.
you can use lower frequency like 200 up to 3200.
the important point is that, your sample frequency fs shoud be at least 2*final frequency.(I think I wrote wrong in the above code it should be at least 71.5e6)
for the case 200 - 3200 you can use 6400for fs.

请先登录,再进行评论。

回答(2 个)

Mathieu NOE
Mathieu NOE 2021-5-31
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 个评论
majid
majid 2021-5-31
Thank you Mathieu .
I'm trying to create a gaussian chirp signal with below parameters (capture.JPG) , so I should use these f1 and f2 frequencies instead of lower frequencies ?
Do you have any idea about this?
Mathieu NOE
Mathieu NOE 2021-5-31
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
majid 2021-5-31
Let me explain more about what Iwant to do:
I want to create a gaussian chirp signal.
the chirp signal parameters are :
f_initial=29.25MHz , f_final=30MHz , chirp duration=20.5ms
then, I create a gaussian pulse wich will be modulated by chirp signal.
my problem is that, I'm not OK with this chirp signal plot, beacause it doesn't looks like other chirp signals.
I want to know is the plot correct for above chirp parameters or not?
  3 个评论
Mathieu NOE
Mathieu NOE 2021-5-31
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 ?
majid
majid 2021-5-31
hello
look at my codes output (output.jpg) with parameters above, there are four gaps in the plot which is not similar to a chirp signal you have been sent or Matlab examples.
if you Run codes that I sent to you, you can see the similar output.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by