Documentation

高通

高通过滤器信号

描述

y=高通(x,wpass)筛选s the input signalxusing a highpass filter with normalized passband frequencywpassin units ofπrad/sample.高通使用最小订单滤波器,其停止带衰减为60 dB,并补偿过滤器引入的延迟。如果xis a matrix, the function filters each column independently.

example

y=高通(x,fpass,fs)specifies thatx以以下速度采样fs赫兹。fpassis the passband frequency of the filter in hertz.

y=高通(XT,fpass)高通-filters the data in timetableXT使用一个过滤器passband frequency offpass赫兹。所有的变化函数独立过滤器ables in the timetable and all columns inside each variable.

example

y=高通(___,名称,价值)使用名称值对参数为任何以前的语法指定其他选项。您可以更改停止带衰减,过渡带陡度以及过滤器的脉冲响应的类型。

example

[y,d] =高通(___)also returns thedigitalFilterobjectdused to filter the input.

高通(___)with no output arguments plots the input signal and overlays the filtered signal.

例子

全部收缩

创建一个以1 kHz采样的信号,持续1秒。该信号包含两个音调,一种在50 Hz,另一个为250 Hz,嵌入了1/100的高斯白噪声中。高频音调的幅度是低频音调的两倍。

fs = 1e3; t = 0:1/fs:1; x = [1 2]*sin(2*pi*[50 250]'.*t) + randn(size(t))/10;

高通过滤器信号以删除低频音调。指定150 Hz的通带频率。显示原始和过滤的信号以及它们的光谱。

高通(x,150,fs)

实现基本的数字音乐合成器,并使用它播放传统歌曲。指定2 kHz的样本率。绘制歌曲的频谱图。

fs = 2e3; t = 0:1/fs:0.3-1/fs; l = [0 130.81 146.83 164.81 174.61 196.00 220 246.94]; m = [0 261.63 293.66 329.63 349.23 392.00 440 493.88]; h = [0 523.25 587.33 659.25 698.46 783.99 880 987.77]; note = @(f,g) [1 1 1]*sin(2*pi*[l(g) m(g) h(f)]'.*t); mel = [3 2 1 2 3 3 3 0 2 2 2 0 3 5 5 0 3 2 1 2 3 3 3 3 2 2 3 2 1]+1; acc = [3 0 5 0 3 0 3 3 2 0 2 2 3 0 5 5 3 0 5 0 3 3 3 0 2 2 3 0 1]+1; song = [];forkj = 1:length(mel) song = [song note(mel(kj),acc(kj)) zeros(1,0.01*fs)];endsong = song/(max(abs(song))+0.1);% To hear, type sound(song,fs)pspectrum(song,fs,'spectrogram','TimeResolution',0.31,。。。'OverlapPercent',0,“ Minthreshold”,-60)

高通过滤器信号将旋律与伴奏分开。指定450 Hz的通带频率。在时间和频域中绘制原始信号和过滤信号。

Hong = HighPass(Song,450,FS);% To hear, type sound(hong,fs)高通(歌曲,450,FS)

绘制旋律的光谱图。

图Pspectrum(Hong,fs,'spectrogram','TimeResolution',0.31,。。。'OverlapPercent',0,“ Minthreshold”,-60)

Filter white noise sampled at 1 kHz using an infinite impulse response highpass filter with a passband frequency of 200 Hz. Use different steepness values. Plot the spectra of the filtered signals.

FS = 1000;X = Randn(20000,1);[y1,d1] =高通(x,200,fs,,'ImpulseResponse','iir','Steepness',0.5); [y2,d2] = highpass(x,200,fs,'ImpulseResponse','iir','Steepness',0.8);[y3,d3] =高通(x,200,fs,,'ImpulseResponse','iir','Steepness',0.95);pspectrum([y1 y2 y3],fs)传奇('Steepness = 0.5','Steepness = 0.8','Steepness = 0.95')

Compute and plot the frequency responses of the filters.

[H1,F] = Freqz(D1,1024,FS);[H2,〜] = freqz(D2,1024,FS);[H3,〜] = freqz(D3,1024,FS);图(F,MAG2DB(ABS([H1 H2 H3]))))传说('Steepness = 0.5','Steepness = 0.8','Steepness = 0.95') ylim([-130 10])

输入参数

全部收缩

输入信号, specified as a vector or matrix.

例子:罪(2*pi*(0:127)/16)+randn(1,128)/100指定嘈杂的正弦曲线

例子:[2 1]。*sin(2*pi*(0:127)'./ [16 64])specifies a two-channel sinusoid.

数据类型:single|双倍的
Complex Number Support:Yes

归一化通带频率, specified as a scalar in the interval(0,1)

通带频率, specified as a scalar in the interval(0,fs/2)

Sample rate, specified as a positive real scalar.

Input timetable.XTmust contain increasing, finite, and equally spaced row times of typedurationin seconds.

如果时间表缺少或重复时间点,则可以使用这些提示来修复Clean Timetable with Missing, Duplicate, or Nonuniform Times(MATLAB).

例子:时间表(seconds(0:4)',randn(5,1))指定以1 Hz为4秒的随机变量。

名称值对参数

Specify optional comma-separated pairs of名称,价值参数。Nameis the argument name andValueis the corresponding value.Name必须出现在引号中。您可以按任何顺序指定几个名称和值对参数Name1,Value1,...,NameN,ValueN

例子:'ImpulseResponse','iir','StopbandAttenuation',30使用最小订购IIR过滤器过滤输入,该过滤器减弱低于低于fpass到30 dB。

Type of impulse response of the filter, specified as the comma-separated pair consisting of'ImpulseResponse'and'fir','iir', or'auto'

  • 'fir'— The function designs a minimum-order, linear-phase, finite impulse response (FIR) filter. To compensate for the delay, the function appends to the input signalN/2 zeros, whereN是过滤顺序。然后该功能过滤信号并删除第一个N/2输出样本。

    In this case, the input signal must be at least twice as long as the filter that meets the specifications.

  • 'iir'— The function designs a minimum-order infinite impulse response (IIR) filter and uses thefiltfilt功能以执行零相滤波并补偿过滤器延迟。

    如果信号至少不是符合规格的滤波器的三倍,则该函数设计具有较小阶的滤波器,从而较小的陡度。

  • 'auto'— The function designs a minimum-order FIR filter if the input signal is long enough, and a minimum-order IIR filter otherwise. Specifically, the function follows these steps:

    • Compute the minimum order that an FIR filter must have to meet the specifications. If the signal is at least twice as long as the required filter order, design and use that filter.

    • 如果the signal is not long enough, compute the minimum order that an IIR filter must have to meet the specifications. If the signal is at least three times as long as the required filter order, design and use that filter.

    • 如果the signal is not long enough, truncate the order to one-third the signal length and design an IIR filter of that order. The reduction in order comes at the expense of transition band steepness.

    • Filter the signal and compensate for the delay.

过渡带陡度,指定为逗号分隔对'Steepness'and a scalar in the interval[0.5, 1)。随着陡度的增加,滤波器响应接近理想的高通响应,但是所得的滤波器长度和过滤操作的计算成本也会增加。看Highpass Filter Steepness了解更多信息。

过滤器停止带衰减, specified as the comma-separated pair consisting of'StopbandAttenuation'and a positive scalar in dB.

Output Arguments

全部收缩

过滤的信号,作为向量,矩阵或时间表返回,其尺寸与输入相同。

Highpass filter used in the filtering operation, returned as adigitalFilterobject.

  • 采用筛选(D,X)to filter a signalxusingd

  • 采用fvtool(d)可视化过滤器响应。

  • 采用designfiltto edit or generate a digital filter based on frequency-response specifications.

更多的About

全部收缩

Highpass Filter Steepness

The'Steepness'参数控制过滤器过渡区域的宽度。陡度越低,过渡区域越宽。陡度越高,过渡区域越窄。

To interpret the filter steepness, consider the following definitions:

  • TheNyquist频率,fNyquist,是信号的最高频率分量,可以以给定的速率采样而无需混叠。fNyquistis 1 (×πrad/sample) when the input signal has no time information, andfs/2 HERTZ当输入信号为时间表或指定样本率时。

  • Thestopband frequency过滤器,fstop, 是the frequency below which the attenuation is equal to or greater than the value specified using'StopbandAttenuation'

  • The过渡宽度过滤器,W, 是fpassfstop

  • Most nonideal filters also attenuate the input signal across the passband. The maximum value of this frequency-dependent attenuation is called thePassband Ripple。每个使用的过滤器高通通带纹波为0.1 dB。

指定值时,s, for'Steepness', the function computes the transition width as

W=(1 -s) ×fpass

  • 什么时候'Steepness'is equal to 0.5, the transition width is 50% offpass

  • As'Steepness'approaches 1, the transition width becomes progressively narrower until it reaches a minimum value of 1% offpass

  • The default value of'Steepness'is 0.85, which corresponds to a transition width that is 15% offpass

Introduced in R2018a