具有给定中心频率的高斯波生成

Gaussian wave generation with a given central frequency

高斯波的公式为 1/[sqrt(2* pi* 方差)]*exp{-[(x-xo).^2/(2*方差)]};

我把这个问题分为 3 个部分:

1) 如何生成具有给定中心频率的时域高斯信号。

(我试图通过改变"variance"值来控制它,但这是一种试错法。有没有其他简单的方法可以实现它。)

2) 我的第二个问题是确定它的频谱。

(我在时域中生成高斯信号并使用 FFT 对其进行傅里叶变换。问题是所有频率都分布在零赫兹附近,而不是中心频率附近。)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% test for gausssian signal ; Time to Freq
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dt=.0001;
fs=1/dt; %sampling frequency
fn=fs/2;
n=1000;
t=dt*(-n/2:n/2); %time base

sigma=0.001;     variance=sigma^2;

xt=1/(sqrt(2*pi*variance))*(exp(-t.^2/(2*variance)));
subplot(2,1,1); plot(t,xt,'b'); 
title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);
xlabel('Time(s)'); ylabel('Amplitude');

xf = fftshift(fft(xt));
f = fs*(-n/2:n/2)/(n/2); %Frequency Vector
subplot(2,1,2); plot(f,xf.*conj(xf),'r'); title('Magnitude of FFT');      
xlabel('Frequency (Hz)'); ylabel('Magnitude |X(f)|');

3) 作为逆向练习,我定义了给定频率附近的频谱,然后估计了幅度谱。我改变了中心频率 f0,发现脉冲宽度没有改变。如果更高的频率起作用,原则上宽度应该改变。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% test for gausssian signal ; Freq --> Time --> Freq
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;  clear all;

dt=0.001;
fs=1/dt; %sampling frequency
fn=fs/2;
n=200;  % provide a even no

f=1/dt*(-n/2+1:n/2-1)/(n/2); %time base

f0=800 ;  % properties of source: position
sigma=20;     % properties of source: width
variance = sigma^2;

xf=1/(sqrt(2*pi*variance))*(exp(-((f-f0).^2/(2*variance))));
figure(1); subplot(3,1,1); plot(f,xf,'b'); 
title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);
xlabel('Freq');   ylabel('Amplitude');

xt=fftshift(ifft(xf));
t=1/fs*(-n/2+1:n/2-1)/(n/2);
subplot(3,1,2); plot(t,xt.*conj(xt),'b'); 
xlabel('Time(s)');   ylabel('Amplitude');

xtf=(fft((fftshift(xt))));
subplot(3,1,3); plot(f,xtf.*conj(xtf),'b'); 
xlabel('Freq');   ylabel('Amplitude')

正如我在 post 中指出的那样,要将高斯脉冲调制到更高的频率(并保持信号为实值),您必须将信号乘以 cos(2*pi*t*f0):

dt=.0001;
fs=1/dt; %sampling frequency
fn=fs/2;
n=1000;
t=dt*(-n/2:n/2); %time base

sigma=0.001;     variance=sigma^2;

f0 = 1000;
xt=cos(2*pi*t*f0) .* (exp(-t.^2/(2*variance)))/sqrt(2*pi*variance);
subplot(2,1,1); plot(t,xt,'b'); 
title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);
xlabel('Time(s)'); ylabel('Amplitude');
axis([-0.02 0.02]);

xf = fftshift(fft(xt));
f = fs*(-n/2:n/2)/n; %Frequency Vector
subplot(2,1,2); plot(f,abs(xf),'r'); title('Magnitude of FFT');      
xlabel('Frequency (Hz)'); ylabel('Magnitude |X(f)|');

这应该会给您类似的结果: