应用低通滤波器

格伦

我想在MATLAB中使用上采样然后是低通滤波器来模拟插值器。首先,我通过引入0对信号进行了上采样。

上采样信号

现在,我想应用低通滤波器以进行插值。我设计了以下过滤器:

过滤器设计

滤波器恰好是归一化频率的1/8,因为我需要在之后进行下采样。(按此特定顺序对插值和采样进行上采样是一种特殊的技巧。)

但是,当我使用函数将此过滤器应用于数据时,filter(myfilter, data)会生成以下信号:滤波信号

I really don't know what is happening to my signal because in theory I know an interpolated signal should appear. This is the first time I'm working in MATLAB with filters because till now we only had the theory and had to assume ideal filters and analytical solutions.

Can someone give me an indication what might be wrong? I use the following code:

clear all; close all;

% Settings parameters
fs=10e6; 
N=10;
c=3/fs;
k=3;
M=8;

% Settings time and signal 
t=0:fs^-1:N*fs^-1;
x=exp(-(t.^2)./(2.*c.^2)); % Gaussian signal

% Upsampling
tu=0:(fs*M)^-1:N*fs^-1;
xu=zeros(1,size(tu,2));
sample_range=1:M:size(xu,2);
for i=1:size(x,2);
    xu(sample_range(i))=x(i);
end;

%% Direct Method

xf=filter(lpf5mhz,xu); 
SleuthEye

As suggested by hotpaw2's answer, the low-pass filter needs some time to ramp up to the input signal values. This is particularly obvious with signal with sharp steps such as yours (the signal implicitly includes a large step at the first sample since past samples are assumed to be zeros by the filter call). Also, with your design parameters the delay of the filter is greater than the maximum time range shown on your output plot (1e-6), and correspondingly the output remains very small for the time range shown.

To illustrate the point, we can take a look at the filtered output with smaller filter lengths (and correspondingly smaller delays), using filters generated with fir1(length,0.125):

在此处输入图片说明

Given a signal with a smoother transition such as a Gaussian pulse which has been sufficiently time delayed:

delay = 10/fs;
x=exp(-((t-delay).^2)./(2.*c.^2)); % Gaussian signal

滤波器可以更好地提高到信号值:

在此处输入图片说明

你可能注意到了,接下来的事情,就是滤波输出有1/M幅度为未经过滤的信号。要获得与未滤波信号幅度相似的内插信号,您必须使用以下方法缩放滤波器输出:

xf=M*filter(lpf5mhz,1,xu);

在此处输入图片说明

最终,信号被滤波操作延迟。因此,出于比较目的,您可能希望绘制带有以下内容的时移版本:

filter_delay = (1/(M*fs))*(length(lpf5mhz)-1)/2;
plot(tu-(1/(M*fs))*(length(b)-1)/2, xf);

在此处输入图片说明

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

应用低通滤波器

来自分类Dev

FFT低通滤波器

来自分类Dev

FPGA的低通滤波器

来自分类Dev

FFT低通滤波器

来自分类Dev

在音频上使用低通滤波器

来自分类Dev

使用fft的Matlab低通滤波器

来自分类Dev

OpenCL中的低通滤波器

来自分类Dev

Python中的低通滤波器

来自分类Dev

低通滤波器和采样频率

来自分类Dev

C中的低通滤波器

来自分类Dev

低通滤波器不起作用

来自分类Dev

固定点的简单低通滤波器

来自分类Dev

使用双线性方法将低通滤波器应用于信号-MATLAB

来自分类Dev

MATLAB中的低通滤波器返回NaN值

来自分类Dev

优化低通滤波器平滑代码以进行活动识别

来自分类Dev

Matlab-在系统上使用低通滤波器

来自分类Dev

IIR低通滤波器在C ++中的实现

来自分类Dev

在Python中表示低通滤波器时的直线

来自分类Dev

将SOX低通滤波器与插孔配合使用

来自分类Dev

使用Pulseaudio在LFE上进行低通滤波器

来自分类Dev

在Matlab中设计一个低通滤波器

来自分类Dev

识别过滤器的方法。(低通滤波器/高通滤波器?)

来自分类Dev

识别过滤器的方法。(低通滤波器/高通滤波器?)

来自分类Dev

在尺寸为NxM的图像上应用低通滤波器(AxB)的过程中没有计算量

来自分类Dev

具有低通滤波器的脱机渲染会导致混叠和剪切

来自分类Dev

在SciPy中创建低通滤波器-了解方法和单位

来自分类Dev

关于在Matlab中使用'butter'功能的低通滤波器的问题

来自分类Dev

低通滤波器从熊猫数据框中获取数据的二阶导数

来自分类Dev

高通低通滤波器信号,去除边缘伪像Matlab