MATLAB: Fourier transform of this:

fourier transform

hi this is my shape that i want it's fourier transform
this is my code:
clc
clear all
t=-3:0.0001:3;
%x=-heaviside(t+2)
%y=t
%z=rectangularPulse(t-1)
%unitstep = t>-1;
%ramp = t.*unitstep;
f= -heaviside(t+2)+ heaviside(t+1)+t.*(t>=-1)-t.*(t>=1)+ heaviside(t-1)-heaviside(t-2)
figure(1)
plot(t,f)
axis([-3,3,-2,2])
FT=fourier(f)
this is error:
Undefined function 'fourier' for input arguments of type 'double'.
Error in Untitled12 (line 19)
FT=fourier(f)
how could i fix this?
the result of my code:
untitled5.jpg

Best Answer

FT=fft(f);
First FFT then plot, requested you to read this documentation
Related Question