📜  MATLAB 中的傅立叶变换

📅  最后修改于: 2022-05-13 01:54:26.701000             🧑  作者: Mango

MATLAB 中的傅立叶变换

傅立叶变换是一种数学技术,有助于将时域函数x(t) 转换为频域函数X(ω)。在本文中,我们将看到如何在 MATLAB 中找到傅立叶变换。

傅里叶变换的数学表达式为: X(ω) = F\{x(t)\} = ∫_{-∞}^∞x(t).e^{(-jωt)} dt

使用上述函数可以生成任何表达式的傅立叶变换。在 MATLAB 中,傅立叶 命令返回给定函数的傅立叶变换。可以使用 3 种不同的语法为傅立叶函数提供输入。

  • Fourier(x):在这种方法中,x 是时域函数,而自变量由symvar确定,变换变量默认为w
  • Fourier(x,transvar):这里, x是时域函数,而transvar是变换变量而不是 w。
  • Fourier(x,indepvar,transvar):在这个语法中, x是时域函数,而indepvar是自变量, transvar是变换变量,而不是分别代替symvarw

现在我们找到傅立叶变换e^{-t^2} .

示例 1:



Matlab
% MATLAB code to specify the variable t 
% and u as symbolic ones The syms function
% creates a variable dynamically and 
% automatically assigns to a MATLAB variable
% with the same name
syms t u
  
% define time domain function x(t)
x = exp(-t^2-u^2);
  
% fourier command to transform into 
% frequency domain function X(w)
  
% using 1st syntax, where independent variable
% is determined by symvar (u in this case)
% and transformation variable is w by default.
X = fourier(x);
  
% using 2nd syntax, where transformation 
% variable = y
X1=fourier(x,y);
  
% using 3rd syntax, where independent 
% variable = t & transformation variable = y 
X2=fourier(x,t,y);
  
% Display the output value
disp('1. Fourier Transform of exp(-t^2-u^2) using fourier(x) :')
disp(X);
  
disp('2. Fourier Transform of exp(-t^2-u^2) using fourier(x,y) :')
disp(X1);
  
disp('3. Fourier Transform of exp(-t^2-u^2) using fourier(x,t,y) :')
disp(X2);


Matlab
% MATLAB code for specify the variable
% a and t as symbolic ones
syms a t
  
% define time domain function x(t) 
% where t=independent variable & a=constant
x = a*abs(t);
  
% fourier command to transform into frequency
% domain function X(w)
% using 1st syntax
X = fourier(x);
  
% using 2nd syntax, where transformation 
% variable = y
X1 = fourier(x,y);
  
% using 3rd syntax, where transformation variable
% = y & independent
% variable = t (as t is the only other variable)
X2 = fourier(x,t,y);
  
% Display the output value
disp('1. Fourier Transform of a*abs(t) using fourier(x):')
disp(X);
  
disp('2. Fourier Transform of a*abs(t) using fourier(x,y):')
disp(X1);
  
disp('3. Fourier Transform of a*abs(t) using fourier(x,t,y):')
disp(X2);


输出:

让我们再举一个例子来找出 a*abs(t) 的傅立叶变换。

示例 2:

MATLAB

% MATLAB code for specify the variable
% a and t as symbolic ones
syms a t
  
% define time domain function x(t) 
% where t=independent variable & a=constant
x = a*abs(t);
  
% fourier command to transform into frequency
% domain function X(w)
% using 1st syntax
X = fourier(x);
  
% using 2nd syntax, where transformation 
% variable = y
X1 = fourier(x,y);
  
% using 3rd syntax, where transformation variable
% = y & independent
% variable = t (as t is the only other variable)
X2 = fourier(x,t,y);
  
% Display the output value
disp('1. Fourier Transform of a*abs(t) using fourier(x):')
disp(X);
  
disp('2. Fourier Transform of a*abs(t) using fourier(x,y):')
disp(X1);
  
disp('3. Fourier Transform of a*abs(t) using fourier(x,t,y):')
disp(X2);

输出: