English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
MATLAB provides commands for handling transformations such as Laplace and Fourier transforms. Transformations are used as tools for simplifying analysis and viewing data from another perspective in science and engineering.
For example, the Fourier transform allows us to convert a signal represented as a time function into a frequency function. The Laplace transform allows us to convert differential equations into algebraic equations.
MATLAB provideslaplace,fourierandfftTransformation commands to handle Laplace, Fourier, and Fast Fourier Transform operations.
The Laplace transform of the time function f(t) is given by the following integral-
The Laplace transform is also known as the transformation of f(t) to F(s). You can see that this transformation or integration process converts the function f(t) of the symbolic variable t to another function F(s) with another variable s.
The Laplace transform converts differential equations into algebraic equations. To calculate the Laplace transform of the function f(t), please write-
laplace(f(t))
In this example, we will calculate the Laplace transforms of some common functions.
Create a script file and enter the following code-
syms s t a b w laplace(a) laplace(t^2) laplace(t^9) laplace(exp(-b*t)) laplace(sin(w*t)) laplace(cos(w*t))
When the file is run, it displays the following result-
ans = 1/s^2 ans = 2/s^3 ans = 362880/s^10 ans = 1/(b + s) ans = w/(s^2 + w^2) ans = s/(s^2 + w^2)
MATLAB allows us to use the following commands to calculate the inverse Laplace transformilaplace.
For example,
ilaplace(1/s^3)
MATLAB will execute the above statements and display the results-
ans = t^2/2
Create a script file and enter the following code-
syms s t a b w ilaplace(1/s^7) ilaplace(2/(w+s)) ilaplace(s/(s^2+4)) ilaplace(exp(-b*t)) ilaplace(w)/(s^2 + w^2)) ilaplace(s/(s^2 + w^2))
When the file is run, it displays the following result-
ans = t^6/720 ans = 2*exp(-t*w) ans = cos(2*t) ans = ilaplace(exp(-b*t), t, x) ans = sin(t*w) ans = cos(t*w)
The Fourier transform usually transforms the mathematical function f(t) into a new function, sometimes represented by F, whose parameter is frequency, unit of cycle/Second (Hertz) or radian/Second. The new function is then called the Fourier transform and/or the spectrum of the function f.
Create a script file and enter the following code-
syms x f = exp(-2*x^2); % our function ezplot(f,[-2,2]) % plot of our function FT = fourier(f) % Fourier transform
When the file is run, MATLAB draws the following graph-
Display the following result-
FT = (2^(1/2)*pi^(1/2)*exp(-w^2/8))/2
to plot the Fourier transform as-
ezplot(FT)
to the following figure-
MATLAB providesifourierCommand for calculating the inverse Fourier transform of a function. For example,
f = ifourier(-2*exp(-abs(w)))
MATLAB will execute the above statements and display the results-
f = -2/(pi*(x^2 + 1))