主要内容

fourier

R2026b

符号表达式或符号函数的傅里叶变换

描述

FT = fourier(f) 返回 f 的傅里叶变换。默认情况下,函数 symvar 确定自变量,w 是变换变量。

示例

FT = fourier(f,transVar) 使用变换变量 transVar 而不是 w。

示例

FT = fourier(f,var,transVar) 分别使用自变量 var 和变换变量 transVar,而不是 symvar(f,1) 和 w。

示例

示例

全部折叠

计算常用函数的傅里叶变换。默认情况下,变换以 w 为变换变量。

求矩形脉冲函数的傅里叶变换。

syms a b t
f = rectangularPulse(a,b,t);
FT = fourier(f)
FT = 

-sin(a w)+cos(a w) iw+sin(b w)+cos(b w) iw

求单位冲激(狄拉克 δ 函数)的傅里叶变换。

f = dirac(t);
FT = fourier(f)
FT = 1

求绝对值函数的傅里叶变换。

f = a*abs(t);
FT = fourier(f)
FT = 

-2 aw2

求阶跃函数(海维赛德函数)的傅里叶变换。

f = heaviside(t);
FT = fourier(f)
FT = 

π δdirac(w)-iw

求常数的傅里叶变换。

f = a;
FT = fourier(f)
FT = 2 π δdirac′(w) i

求余弦函数的傅里叶变换。

f = a*cos(b*t);
FT = fourier(f)
FT = π a δdirac(b+w)+δdirac(b-w)

求正弦函数的傅里叶变换。

f = a*sin(b*t);
FT = fourier(f)
FT = π a δdirac(b+w)-δdirac(b-w) i

求符号函数的傅里叶变换。

f = sign(t);
FT = fourier(f)
FT = 

-2 iw

在不进行任何假设的情况下,求右侧指数函数的傅里叶变换。

f = exp(-t*abs(a))*heaviside(t);
FT = fourier(f)
FT = 

1|a|+w i-sign(|a|)2-12 fourier(e-t |a|,t,w)

假设 a > 0,求右侧指数函数的傅里叶变换。计算傅里叶变换后清除假设。

assume(a > 0)
FTwithAssumption = fourier(f)
FTwithAssumption = 

1a+w i

assume(a,"clear")

假设 a > 0,求双侧指数函数的傅里叶变换。计算傅里叶变换后清除假设。

assume(a > 0)
f = exp(-a*t^2);
FTwithAssumption = fourier(f)
FTwithAssumption = 

π e-w24 aa

assume(a,"clear")

假设 b 和 c 为实数,求高斯函数的傅里叶变换。在计算傅里叶变换后,简化结果并清除假设。

syms c
assume([b c],"real")
f = a*exp(-(t-b)^2/(2*c^2));
FT = fourier(f);
FTsimplified = simplify(FT)
FTsimplified = 

2 a π e-w w c2+2 b i2 |c|

assume([b c],"clear")

求 nu = 1 时第一类贝塞尔函数的傅里叶变换。简化结果。

syms x
f = besselj(1,x);
FT = fourier(f);
FTsimplified = simplify(FT)
FTsimplified = 

-2 w rectangularPulse(-1,1,-w) i1-w2

求 exp(-t^2-x^2) 的傅里叶变换。默认情况下,symvar 确定自变量,w 是变换变量。此处,symvar 选择 x。

syms t x
f = exp(-t^2-x^2);
FT = fourier(f)
FT = 

π e-t2-w24

将变换变量指定为 y。如果您仅指定一个变量,则该变量是变换变量。symvar 仍会确定自变量。

syms y
FT = fourier(f,y)
FT = 

π e-t2-y24

将自变量和变换变量分别指定为 t 和 y。

FT = fourier(f,t,y)
FT = 

π e-x2-y24

创建一个起点为 –1/2 并且终点为 1/2 的矩形脉冲。

syms t
f1 = rectangularPulse(-1/2,1/2,t);

求其傅里叶变换。简化结果。此处,傅里叶变换仅包含实部。

FT1 = fourier(f1);
FT1 = simplify(FT1)
FT1 = 

2 sin(w2)w

使用 fplot 在 2×2 分块图布局中绘制该矩形脉冲。绘制其傅里叶变换的实部和虚部。

tiledlayout(2,2)

nexttile
fplot(f1)
xlabel("$t$",Interpreter="latex")
ylabel("$f(t)$",Interpreter="latex")
title("Rectangular Pulse")

nexttile
fplot(real(FT1),[-50 50])
hold on
fplot(imag(FT1),[-50 50])
xlabel("$w$",Interpreter="latex")
ylabel("FT($w$)",Interpreter="latex")
title("Fourier Transform")
legend("Re(FT)","Im(FT)",Location="northeastoutside")

Figure contains 2 axes objects. Axes object 1 with title Rectangular Pulse, xlabel $t$, ylabel $f(t)$ contains an object of type functionline. Axes object 2 with title Fourier Transform, xlabel $w$, ylabel FT($w$) contains 2 objects of type functionline. These objects represent Re(FT), Im(FT).

接下来,创建另一个起点为 0 并且终点为 1 的矩形脉冲。

f2 = rectangularPulse(0,1,t);

求其傅里叶变换。此处,傅里叶变换同时包含实部和虚部。

FT2 = fourier(f2)
FT2 = 

sin(w)+cos(w) iw-iw

绘制该矩形脉冲。绘制其傅里叶变换的实部和虚部。

nexttile
fplot(f2)
xlabel("$t$",Interpreter="latex")
ylabel("$f(t)$",Interpreter="latex")

nexttile
fplot(real(FT2),[-50 50])
hold on
fplot(imag(FT2),[-50 50])
xlabel("$w$",Interpreter="latex")
ylabel("FT($w$)",Interpreter="latex")
legend("Re(FT)","Im(FT)",Location="northeastoutside")

Figure contains 4 axes objects. Axes object 1 with title Rectangular Pulse, xlabel $t$, ylabel $f(t)$ contains an object of type functionline. Axes object 2 with title Fourier Transform, xlabel $w$, ylabel FT($w$) contains 2 objects of type functionline. These objects represent Re(FT), Im(FT). Axes object 3 with xlabel $t$, ylabel $f(t)$ contains an object of type functionline. Axes object 4 with xlabel $w$, ylabel FT($w$) contains 2 objects of type functionline. These objects represent Re(FT), Im(FT).

求 t^3 的傅里叶变换。结果以狄拉克 δ 函数的三阶导数表示。

syms t w
FT = fourier(t^3,t,w)
FT = -2 π δdirac′′′(w) i

求在 t0 处具有不连续点的海维赛德函数的傅里叶变换。

syms t0
FT = fourier(heaviside(t - t0),t,w)
FT = 

e-t0 w i π δdirac(w)-iw

如在详细信息一节中所述,c 和 s 是傅里叶变换的参数。默认情况下,fourier 函数使用 c=1 和 s=-1。但是,您可以使用 sympref 来更改这些参数值。

使用傅里叶参数的默认值计算 t*exp(-t^2) 的傅里叶变换。

syms t w
f = t*exp(-t^2);
FT = fourier(f,t,w)
FT = 

-w π e-w24 i2

使用 sympref 将傅里叶参数更改为 c = 1 和 s = 1,然后再次计算变换。结果发生变化。

sympref("FourierParameters",[1 1]);
FT = fourier(f,t,w)
FT = 

w π e-w24 i2

将傅里叶参数更改为 c = 1/(2*pi) 和 s = 1,然后再次计算变换。结果发生变化。

sympref("FourierParameters",[1/(2*sym(pi)) 1]);
FT = fourier(f,t,w)
FT = 

w e-w24 i4 π

使用 sympref 设置的符号设置会在当前和以后的 MATLAB® 会话中持续有效。将 FourierParameters 设置为 "default",以恢复 c 和 s 的默认值。

sympref("FourierParameters","default");

求矩阵 M 的傅里叶变换。使用相同大小的矩阵为每个矩阵元素指定自变量和变换变量。当参量为非标量参量时,fourier 按元素对它们进行操作。

syms a b c d w x y z
M = [exp(x) 1; sin(y) 1i*z];
vars = [w x; y z];
transVars = [a b; c d];
FT = fourier(M,vars,transVars)
FT = 

(2 π ex δdirac(a)2 π δdirac(b)-π δdirac(c-1)-δdirac(c+1) i-2 π δdirac′(d))

如果您在既有标量参量又有非标量参量的情况下调用 fourier,则它会使用标量扩展将标量参量扩展为与非标量参量匹配。非标量参量的大小必须相同。

FT = fourier(x,vars,transVars)
FT = 

(2 π x δdirac(a)2 π δdirac′(b) i2 π x δdirac(c)2 π x δdirac(d))

如果 fourier 无法对输入进行变换,则它会返回未计算的调用。

syms f(t) w
FT = fourier(f,t,w)
FT = fourier(f(t),t,w)

使用 ifourier 来返回原始表达式。

f = ifourier(FT,w,t)
f = f(t)

通过对每个自变量依次独立应用一系列一维傅里叶变换,求二维傅里叶变换。

在此示例中,将傅里叶参数设置为 c=1 和 s=2π,使二维傅里叶变换的公式为:

F(u,v)=∫-∞∞∫-∞∞f(x,y)ei(2πux+2πvy)dxdy.

您可以使用 sympref 来指定这些参数。

sympref("FourierParameters",[1 2*sym(pi)]);

求位于原点、宽度为 a 并且高度为 b 的二维单位矩形的二维傅里叶变换。先对变量 x 执行一维傅里叶变换,然后对变量 y 执行一维傅里叶变换。简化结果。

syms x y a b real
f(x,y) = rectangularPulse(-a/2,a/2,x)*rectangularPulse(-b/2,b/2,y);
syms u v
FT = fourier(f,x,u);
FT = fourier(FT,y,v);
FT = simplify(FT)
FT = 

sin(π a u) sin(π b v)u v π2

求在 x 方向和 y 方向上的标准差均为 σ 的二维高斯函数的傅里叶变换。

syms sigma real
f(x,y) = 1/2/sym(pi)/sigma^2*exp((-x^2-y^2)/2/sigma^2);
syms u v
FT = fourier(f,x,u);
FT = fourier(FT,y,v);
FT = simplify(FT)
FT = e-2 σ2 π2 u2+v2

求位于 (x,y)=(0,a) 和 (x,y)=(0,-a) 的两个点源的傅里叶变换。

f(x,y) = 1/2*dirac(x)*(dirac(y-a)+dirac(y+a));
FT = fourier(f,x,u);
FT = fourier(FT,y,v);
FT = simplify(FT)
FT = cos(2 π a v)

求单位圆孔径的傅里叶变换。使用 heaviside 函数定义单位圆。

f(x,y) = heaviside(x^2+y^2-1);
FT = fourier(f,x,u);
FT = fourier(FT,y,v)
FT = fourier(fourier(heaviside(x2+y2-1),x,u),y,v)

此处,fourier 函数无法对输入函数进行变换,因此返回未计算的调用。作为替代方法,您可以使用 fft2 函数以数值方式求二维傅里叶变换。有关如何求圆形孔径的二维傅里叶变换的示例,请参阅二维傅里叶变换。

使用 sympref 设置的符号设置会在当前和以后的 MATLAB 会话中持续有效。还原默认设置。

sympref("default");

输入参数

全部折叠

输入,指定为符号表达式、函数、向量或矩阵。

变换变量,指定为符号变量、符号表达式、符号向量或符号矩阵。此变量通常称为“频率变量”。默认情况下,fourier 使用 w。如果 w 是 f 的自变量,则 fourier 使用 v。

自变量,指定为符号变量、符号向量或符号矩阵。此变量通常称为“时间变量”或“空间变量”。如果您不指定此参量,则 fourier 使用函数 symvar(f,1) 来确定自变量。

详细信息

全部折叠

提示

  • 如果任何参量为数组,则 fourier 对该数组中的所有元素按元素进行操作。

  • 如果第一个参量包含符号函数,则第二个参量必须是标量。

  • 要计算傅里叶逆变换,请使用 ifourier。

  • fourier 不对 piecewise 进行变换。请尝试改用 heaviside、rectangularPulse 或 triangularPulse 函数重写 piecewise。

参考

[1] Oberhettinger, Fritz. Tables of Fourier Transforms and Fourier Transforms of Distributions. Berlin, Heidelberg: Springer Berlin Heidelberg, 1990.

版本历史记录

在 R2006a 之前推出