Symbolically Calculating Fourier Transforms with int()

10 views (last 30 days)
For the following function:
x_1 = heaviside(t + 0.5) - heaviside(t - 0.5);
I would like to symbolically compute the Fourier Transform using MATLAB's int() function.
Using as my guide, my attempt was as follows:
FX_1 = int(x_1*exp(-1i*omega*t),t,-inf,inf);
The return was unusable. There are obviously other ways to go about getting the Fourier Transform of a function, but in this instance I am specifically looking to do so using the int() function.
Bonus question: how would you plot the magnitude line spectrum of the function? Would the following work?
omega = -100:0:100;
plot(abs(FX_1),omega)

Accepted Answer

Star Strider
Star Strider on 26 Oct 2019
The heaviside step function is simply 1 on the interval you are interested in.
Try this:
syms omega t
FX_1 = int(1*exp(-1i*omega*t),t,-0.5,0.5);
figure
fplot(FX_1, [-50, 50])
grid
Change the fplot limits to be whatever you want them to be.
  4 Comments
Shawn Cooper
Shawn Cooper on 27 Oct 2019
Awesome, thanks. I didn't realize we could plot the imaginary and real parts in that way. Great advice!

Sign in to comment.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!