EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Data Science Data Science Tutorials Matlab Tutorial Fourier Transform Matlab
 

Fourier Transform Matlab

Updated March 13, 2023

Fourier Transform Matlab

 

 

Introduction to Fourier Transform in Matlab

Matlab is a programming environment that is interactive and is used in scientific computing. It is extensively used in a lot of technical fields where problem-solving, data analysis, algorithm development, and experimentation are required. Software that is discipline-specific is extensively written using MATLAB.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

In this article, we will study the Matlab function used to calculate the Fourier transform. Before we get into details of how Fourier function works in Matlab, let us refresh our understanding of the Fourier transform.

The Fourier Transform uses a time-based pattern and measures every probable cycle of a signal. It then returns amplitude, rotation speed, and offset for each cycle that it found. In simpler terms, it returns significant features of signals called frequency components.

Let us understand the syntax of the Fourier function in Matlab.

Fourier (f)

Description of Fourier function in Matlab:

Fourier (f) returns the Fourier transform of input signal ‘f’.

Examples

Let us now understand the Fourier function in MATLAB with the help of a few examples

Example #1

In the first example, we will compute Fourier transform of a sine function using Fourier (f):

Lets us take a sine signal defined as:

3 * sin (4 * t)

Mathematically, the output of this signal using Fourier transform will be :

-pi * (dirac (w - 4) – dirac (w + 4)) * 3i

considering that transform is taken with ‘w’ as transformation variable.

Syntax:

syms t [Initializing the variable] f = 3*sin (4*t); [Input sine function] Ft = fourier (f) [Using the fourier function to get the fourier transform]

This is how our input and output will look like in the Matlab console:

Input:

Fourier Transform Matlab 1

Output:

Fourier Transform Matlab 2

As we can see, the transform is in terms of variable ‘w’ and the output is as expected by us.

Example #2

Here is an example where we compute Fourier transform of a cosine signal using Fourier (f):

Lets us take cosine signal defined as:

Cos (4*t) + cos (t);

Mathematically, our output should be:

pi* (dirac (w - 1) + dirac (w + 1)) + pi* (dirac (w - 4) + dirac (w + 4))

Syntax:

syms t[Initializing the variable] f = cos (4*t) + cos (t); [Input cos function] Ft = fourier (f)[Using the fourier function to get the fourier transform]

This is how our input and output will look like in the Matlab console:

Input:

Fourier Transform Matlab 3

Output:

Fourier Transform Matlab 4

As we can see, the Fourier transform is calculated w.r.t ‘w’ and the output is as expected by us.

Example #3

In the next example we will compute Fourier transform of an exponential function using Fourier (f):

Lets us take an exponential function defined as:

exp (-a ^ 2);

Mathematically, our output should be:

pi^(1/2) * exp (-w^2/4)

Syntax:

syms a [Initializing the variable] f = exp (-a^2);[Input exponential function] fourier (f)[Using the fourier function to get the fourier transform]

This is how our input and output will look like in the MATLAB console:

Input:

example 3

Output:

example 3-1

example 3-2

As we can see, the Fourier transform is calculated w.r.t ‘w’ and the output is as expected by us.

Example #4

Now, what if we have a matrix of input signals. In such cases, the Fourier function will calculate the transform of each element of the array individually.

Below is the example where we calculate Fourier transform of a matrix containing 4 elements using Fourier (f):

Lets us define our matrix as:

Z = [sin (a) cos (b); 1 exp (-a^2)]

Now for each element in the matrix, we need to pass transformation & independent variables.

Let us define our independent variable as: Variables = [w a; b c];

And Transform variables as: Transfrom_Variables = [p q; r s]; 

Mathematically, our output should be:

[ 2*pi*sin (a)*dirac (p), 2*pi*cos (b)*dirac (q)] [ 2*pi*dirac (r),pi^ (1/2)*exp (-s^2/4)]

Syntax:

syms a b c w p q r s [Initializing the variables] Z = [sin(a) cos(b); 1 exp(-a^2)];[Input matrix with different signals] Variables = [w a; b c]; [Independent variables] Transfrom_Variables = [p q; r s]; [Transformation variables] Fourier (Z, Variables, Transfrom_Variables)

This is how our input and output will look like in the Matlab console:

Input:

example 3-3

Output:

example 3-4

As we can see, we have got the Fourier transform of every element in the matrix Z.

Conclusion – Fourier Transform Matlab

Fourier function is used in MATLAB to calculate the Fourier transform of a signal. We can calculate the Fourier transform w.r.t to the default transformation variable ‘w’ or the variable we define as the transformation variable.

Recommended Articles

This is a guide to Fourier Transform Matlab. Here we discuss the Introduction, examples with code implementation respectively. You may also have a look at the following articles to learn more –

  1. Matlab Integral
  2. Matlab gca
  3. Matlab min
  4. Matlab xcorr

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

🚀 Limited Time Offer! - ENROLL NOW