matlab计算数字滤波器的幅频响应

1

freqz uses an FFT-basedalgorithm to calculate the Z-transform frequency response of a digitalfilter. Specifically, the statement

[h,w] = freqz(b,a,p)

returns the p-point complex frequency response, H(ejω),of the digital filter.

H(ejω)=b(1)+b(2)ejω+...+b(n+1)ejωna(1)+a(2)ejω+...+a(m+1)ejωm

In its simplest form, freqz accepts the filtercoefficient vectors b and a,and an integer p specifying the number of pointsat which to calculate the frequency response. freqz returnsthe complex frequency response in vector h, andthe actual frequency points in vector w in rad/s.


[h,w]= freqz(b,a,n)
[h,w] = freqz(sos,n)
[h,w] = freqz(d,n)
[h,w]= freqz(___,n,'whole')
[h,f]= freqz(___,n,fs)
[h,f]= freqz(___,n,'whole',fs)
h = freqz(___,w)
h = freqz(___,f,fs)
freqz(___)

Description

example

[h,w]= freqz(b,a,n) returnsthe n-point frequency response vector, h, and the corresponding angularfrequency vector, w, forthe digital filter with numerator and denominator polynomial coefficientsstored in b and a, respectively.

example

[h,w] = freqz(sos,n) returnsthe n-point complex frequency response correspondingto the second-order sections matrix, sos.

example

[h,w] = freqz(d,n) returnsthe n-point complex frequency response for thedigital filter, d.

[h,w]= freqz(___,n,'whole') returnsthe frequency response at n sample points aroundthe entire unit circle.

[h,f]= freqz(___,n,fs) returnsthe frequency response vector, h,and the corresponding physical frequency vector, f, for the digital filter with numeratorand denominator polynomial coefficients stored in b and a,respectively, given the sampling frequency, fs.

[h,f]= freqz(___,n,'whole',fs) returnsthe frequency at n points ranging between 0 and fs.

h = freqz(___,w) returnsthe frequency response vector, h, at the normalizedfrequencies supplied in w.

h = freqz(___,f,fs) returnsthe frequency response vector, h, at the physicalfrequencies supplied in f.

example

freqz(___) withno output arguments plots the frequency response of the filter.

Note:   If the input to freqz issingle precision, the frequency response is calculated using single-precisionarithmetic. The output, h, is single precision.


2

FREQZ 是计算数字滤波器的频率响应的函数

    [H,W] = FREQZ(B,A,N) returns the N-point complex frequency response

    vector H and the N-point frequency vector W in radians/sample of

    the filter:

 函数的输出:a.滤波器的频率响应H(N点)  b.频率向量W(N点,且单位为弧度)

其中,滤波器形式如下:

 MATLAB中freqz函数的用法 - 乱七八糟 - radar_23 的博客

 

given numerator and denominator coefficients in vectors B and A. The

    frequency response is evaluated at N points equally spaced around the

    upper half of the unit circle. If N isn't specified, it defaults to    512.

 滤波器的系数:

分子为B,分母为A  

  频率向量W,是均匀分布在滤波器的上半区,即:0:pi,这些点上的频率响应都将通过此函数计算出来。

举例:

假设滤波器的系数A=1,B=【1 1/2 1/3 1/4】;通过FREQZ函数便可以得到此滤波器的频率特性

其中,需要考察的是H和W的长度,看是否符合我们设置的N。

 MATLAB中freqz函数的用法 - 乱七八糟 - radar_23 的博客

     [H,W] = FREQZ(B,A,N,'whole') uses N points around the whole unit circle.

    函数给出了滤波器的双边频率特性,是N点的

    H = FREQZ(B,A,W) returns the frequency response at frequencies

    designated in vector W, in radians/sample (normally between 0 and pi).

    函数的输出依然是滤波器的频率响应H,只不过这个H是限定了范围的,不再是全频率(0:pi)上的了,这个范围由W来指定,单位是弧度。

举例:W=【0.5pi----pi】,下图中,红线部分便是此函数的输出,可见,只描述了【0.5pi----pi】之间的频率响应。

    [H,F] = FREQZ(B,A,N,Fs) and [H,F] = FREQZ(B,A,N,'whole',Fs) return

    frequency vector F (in Hz), where Fs is the sampling frequency (in Hz).

注意下图的横坐标与程序中fs的关系

    H = FREQZ(B,A,F,Fs) returns the complex frequency response at the

    frequencies designated in vector F (in Hz), where Fs is the sampling

    frequency (in Hz).

    FREQZ(B,A,...) with no output arguments plots the magnitude and

    unwrapped phase of the filter in the current figure window.


3

MATLAB提供了专门用于求离散系统频响特性的函数freqz(),调用freqz()的格式有以下两种:

(1)[H,w]=freqz(B,A,N)

(2)[H,w]=freqz(B,A,N,’whole’)

   (1)中B和A分别为离散系统的系统函数分子、分母多项式的系数向量,返回量H则包含了离散系统频响在0~pi范围内N个频率等分点的值(其中N为正整数),w则包含了范围内N个频率等分点。调用默认的N时,其值是512。

(2)中调用格式将计算离散系统在0~pi范内的N个频率等分店的频率响应的值。

因此,可以先调用freqz()函数计算系统的频率响应,然后利用abs()和angle()函数及plot()函数,即可绘制出系统在或 范围内的频响曲线。

绘制如下系统的频响曲线

H(z)=(z-0.5)/z


 

 MATLAB命令如下:

    B=[1-0.5];

    A =[10];

   [H,w]=freqz(B,A,400,'whole');

   Hf=abs(H);

   Hx=angle(H);

    clf

   figure(1)

   plot(w,Hf)

title('离散系统幅频特性曲线')

   figure(2)

   plot(w,Hx)

   title('离散系统相频特性曲线')



  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值