原文地址: https://www.computationalimaging.cn/2018/11/matlab.html
卷积计算起来较为繁琐, 若能够用matlab辅助计算则会简单很多. 通过使用卷积定理和MATLAB符号函数, 便可以计算连续函数的卷积表达式.
fourier Fourier integral transform.
F = fourier(f) is the Fourier transform of the symbolic expression
or function f with default independent variable x. If f does not
contain x, then the default variable is determined by SYMVAR.
By default, the result F is a function of w. If f = f(w), then F
is returned as a function of the variable v, F = F(v).
By definition, F(w) = c*int(f(x)*exp(s*i*w*x),x,-inf,inf).
You can set the parameters c,s to any numeric or symbolic values
by setting the preference SYMPREF('FourierParameters',[c,s]).
By default, the values are c = 1 and s = -1.
F = fourier(f,v) returns F as a function of the variable v
instead of the default variable w:
F(v) = c*int(f(x)*exp(s*i*v*x),x,-inf,inf).
F = fourier(f,u,v) treats f as a function of the variable u instead
of the default variable x:
F(v) = c*int(f(u)*exp(s*i*v*u),u,-inf,inf).
Examples:
syms t v w x f(x)
fourier(1/t) returns -pi*sign(w)*1i
fourier(exp(-x^2),x,t) returns pi^(1/2)*exp(-t^2/4)
fourier(exp(-t)*heaviside(t),v) returns 1/(1+v*1i)
fourier(diff(f(x)),x,w) returns w*fourier(f(x),x,w)*1i
ifourier Inverse Fourier integral transform.
f = ifourier(F) is the inverse Fourier transform of the symbolic
expression or function F with default independent variable w. If
F does not contain w, then the default variable is determined by
SYMVAR. By default, the result f is a function of x. If F = F(x),
then f is returned as a function of the variable t, f = f(t).
By definition,
f(x) = abs(s)/(2*pi*c) * int(F(w)*exp(-s*i*w*x),w,-inf,inf).
You can set the parameters c,s to any numeric or symbolic values
by setting the preference SYMPREF('FourierParameters',[c,s]).
By default, the values are c = 1 and s = -1.
f = ifourier(F,u) returns f as a function of the variable u
instead of the default variable x:
f(u) = abs(s)/(2*pi*c) * int(F(w)*exp(-s*i*w*u),w,-inf,inf).
f = ifourier(F,v,u) treats F as a function of the variable v
instead of the default variable w:
f(u) = abs(s)/(2*pi*c) * int(F(v)*exp(-s*i*v*u),v,-inf,inf).
Examples:
syms t u v w f(x)
ifourier(w*exp(-3*w)*heaviside(w)) returns 1/(2*pi*(-3+x*1i)^2)
ifourier(1/(1 + w^2),u) returns exp(-abs(u))/2
ifourier(v/(1 + w^2),v,u) returns -(dirac(1,u)*1i)/(w^2+1)
ifourier(fourier(f(x),x,w),w,x) returns f(x)
syms t
fourier(exp(-2*abs(t-1)))
>> fourier(exp(-2*abs(t-1)))
ans =
- exp(-w*1i)/(- 2 + w*1i) + exp(-w*1i)/(2 + w*1i)
>> syms w
>> ifourier(dirac(w))
ans =
1/(2*pi)
syms t
>> xt = exp((cos(3*t + 0.25*pi)))
xt =
exp(cos(3*t + pi/4))
>> f_xt=fourier(xt)
f_xt =
fourier(exp(cos(3*t + pi/4)), t, w)
>> f_ht=fourier(dirac(t-3))
f_ht =
exp(-w*3i)
>> result = ifourier(f_xt * f_ht)
result =
exp(cos(3*x + pi/4 - 9))
syms t
ft = sin(t)*sin(t)/(t*t);
ft = sin(t)*sin(t)/(t*t);
vt = sin(t+pi/3);
f_ft = fourier(ft);
f_vt = fourier(vt);
f_anss = f_ft * f_vt;
fv = ifourier(f_anss);
result = int(fv, [-pi, pi])
result =
0