【发布时间】:2016-05-14 16:53:17
【问题描述】:
高斯波的公式是 1/[sqrt(2* pi* 方差)]*exp{-[(x-xo).^2/(2*方差)]};
这个问题分为三个部分:
1) 如何生成具有给定中心频率的时域高斯信号。
(我试图通过改变“方差”值来控制它,但这是一种试错法。有没有其他简单的方法来实现它。)
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')
【问题讨论】:
标签: matlab signal-processing fft gaussian ifft