freqz2
二维频率响应
语句
[H,f1,f2] = freqz2(h)
[H,f1,f2] = freqz2(h,[n1 n2])
[H,f1,f2] = freqz2(h,f1, f2)
[___] = freqz2(h,___,[dx dy])
freqz2(___)
说明
[
的返回值 H
,f1
,f2
] = freqz2(h
)H是h的64*64频率响应,f1和f2是长度为64的频率向量。
h
是一个二维的有限脉冲响应滤波器(FIR filter),其形式为计算单元(computational molecule)。
freqz2
所返回的 f1
和 f2
是在-1至1间标准化过的,1.0相当于采样频率的一半, 或π弧度。
[
返回的 H
,f1
,f2
] = freqz2(h
,[n1 n2]
)H
是 h的n2
*n1
频率响应, f1和f2长度分别为n1和n2。[n1 n2]可以被指定为两个分离的参量n1,n2。
[
返回有限脉冲响应滤波器 H
,f1
,f2
] = freqz2(h
,f1, f2
)h
在频率值在f1间f2的频率响应。f1 f2必须在-1.0到1.0范围内,1.0相当于采样频率的一半, 或π弧度。[f1 f2]可以被指定为两个分离的参量f1,f2。
[___] = freqz2(h,___,
使用[dx dy]覆盖h中的样本间距。还可以指定一个标量来指定x和y维度中的间距。[dx dy]
)
freqz2(___)
在没有指定输出参数时,生成二维幅度频率响应的网格图。
示例
观察滤波器的频率响应
本示例展示了如何使用fwind1创建二维滤波器和如何使用freqz2观察该滤波器的频率响应
创建理想频率响应
Hd = zeros(16,16);
Hd(5:12,5:12) = 1;
Hd(7:10,7:10) = 0;
创建一维窗口。本示例使用长度为16的巴特兰窗口。
w = [0:2:16 16:-2:0]/16;
使用fwind1
创建16*16滤波器和一维窗口。此滤波器最接近理想频率响应。
h = fwind1(Hd,w);
显示滤波器的实际频率响应。
colormap(parula(64))
freqz2(h,[32 32]);
axis ([-1 1 -1 1 0 1])
注:除h数据类型为single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64外,其他都是double
=====================原文========================
原文地址 https://ww2.mathworks.cn/help/images/ref/freqz2.html
freqz2
2-D frequency response
Syntax
[H,f1,f2] = freqz2(h)
[H,f1,f2] = freqz2(h,[n1 n2])
[H,f1,f2] = freqz2(h,f1, f2)
[___] = freqz2(h,___,[dx dy])
freqz2(___)
Description
[
returns H
,f1
,f2
] = freqz2(h
)H
, the 64
-by-64
frequency response of h
, and the frequency vectors f1
(of length 64
) and f2
(of length 64
). h
is a two-dimensional FIR filter, in the form of a computational molecule.
freqz2
returns f1
and f2
as normalized frequencies in the range -1.0 to 1.0, where 1.0 corresponds to half the sampling frequency, or π radians.
[
returns H
,f1
,f2
] = freqz2(h
,[n1 n2]
)H
, the n2
-by-n1
frequency response of h
, and the frequency vectors f1
(of length n1
) and f2
(of length n2
). You can also specify[n1 n2]
as two separate arguments, n1,n2
.
[
returns the frequency response for the FIR filter H
,f1
,f2
] = freqz2(h
,f1, f2
)h
at frequency values in f1
and f2
. These frequency values must be in the range -1.0 to 1.0, where 1.0 corresponds to half the sampling frequency, or π radians. You can also specify [f1 f2]
as two separate arguments, f1, f2
.
[___] = freqz2(h,___,
uses [dx dy]
)[dx dy]
to override the intersample spacing in h
. You can also specify a scalar to specify the same spacing in both the x and ydimensions.
freqz2(___)
produces a mesh plot of the two-dimensional magnitude frequency response when no output arguments are specified.
Examples
View Frequency Response of Filter
This example shows how to create a two-dimensional filter using fwind1
and how to view the filter's frequency response using freqz2
.
Create an ideal frequency response.
Hd = zeros(16,16);
Hd(5:12,5:12) = 1;
Hd(7:10,7:10) = 0;
Create a 1-D window. This example uses a Bartlett window of length 16.
w = [0:2:16 16:-2:0]/16;
Create the 16-by-16 filter using fwind1
and the 1-D window. This filter gives the closest match to the ideal frequency response.
h = fwind1(Hd,w);
Display the actual frequency response of the filter.
colormap(parula(64))
freqz2(h,[32 32]);
axis ([-1 1 -1 1 0 1])