MATLAB: Symbolically Calculating Fourier Transforms with int()

fourier transformintMATLABsignals

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)

Best Answer

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.