MATLAB信号减采样

在不影响计算结果精度的前提下,为了降低计算成本,通常对信号进行减采样。

减采样之后的样本仍需满足大于奈奎斯特频率,以避免产生混叠。

为了避免发生混叠,通常应在减采样前施加一个抗混叠低通滤波器。

https://cnx.org/contents/p8E-T146@5/Decimation-and-Downsampling

https://dspguru.com/dsp/faqs/multirate/decimation/

 

 

 

 比如一个128Hz的信号,想减采样至32Hz,系数M=4。我们可以先对原始信号进行抗混叠低通滤波,2M=8,截止频率为128/8 = 16Hz。然后进行downsample。减采样之后的样本仍满足大于奈奎斯特频率,避免产生混叠。

 

decimate

减采样之前,为了防止产生混叠对输入进行低通滤波(By default, decimate uses a lowpass Chebyshev Type I IIR filter of order 8.)

y = decimate(x,r)

减采样系数为r,length(y) = ceil(length(x)/r)

y = decimate(x,r,n)

 uses a Chebyshev filter of order n. Orders above 13 are not recommended because of numerical instability.

指定滤波器阶次,由于数值不稳定,一般阶次不超过13。

y = decimate(x,r,'fir')

 uses an FIR filter designed using the window method with a Hamming window. The filter has order 30.

使用基于窗方法设计的FIR滤波器,默认阶次为30。

y = decimate(x,r,n,'fir')

使用基于窗方法设计的FIR滤波器,并指定滤波器阶次。

 

For better results when r is greater than 13, divide r into smaller factors and call decimate several times.

为了获得更好的结果,当r大于13时,将r分成较小的因子,并多次抽取。

r = 13;
n = 16:365;
lx = length(n);
x = sin(2*pi*n/153) + cos(2*pi*n/127);

plot(0:lx-1,x,'o')
hold on
y = decimate(x,r,82,'fir');
stem(0:r:lx-1,y,'ro','filled','markersize',4)

legend('Original','Decimated','Location','south')
xlabel('Sample number')
ylabel('Signal')

 

 downsample

y = downsample(x,n)

decreases the sampling rate of x by keeping every nth sample starting with the first sample. x can be a vector or a matrix. If x is a matrix, each column is considered a separate sequence.

对x减采样,从第一个样本开始,每n个样本取一个。如果x是矩阵,每一列被看做是一个独立序列。

y = downsample(x,n,phase)

指定相位偏移

x = [1 2 3 4 5 6 7 8 9 10];
y = downsample(x,3)

y = 

     1     4     7    10

y = downsample(x,3,2)

y = 

     3     6     9

resample

Resample uniform or nonuniform data to new fixed rate

将均匀或非均匀数据重新采样为新的固定采样频率

y = resample(x,p,q)

resamples the input sequence, x, at p/q times the original sample rate. If x is a matrix, then resample treats each column of x as an independent channel. resample applies an antialiasing FIR lowpass filter to x and compensates for the delay introduced by the filter.

对x重采样,采样频率是原始采样频率的p/q 倍。如果x是矩阵,每一列被看做是一个独立序列。重采样将抗混叠FIR低通滤波器应用于x并补偿滤波器引入的延迟。

 y = resample(x,p,q,n)

uses an antialiasing filter of order 2 × n × max(p,q).

y = resample(x,p,q,n,beta)

specifies the shape parameter of the Kaiser window used to design the lowpass filter.

y = resample(x,p,q,b)

filters x using the filter coefficients specified in b. b为滤波器系数向量。

 

posted on 2020-06-22 13:11  那抹阳光1994  阅读(5731)  评论(0编辑  收藏  举报

导航