t = linspace(-5,5,1000);

x1 = sin(pi*t)./(pi*t);
x2 = sin(2*pi*(t-1))./(pi*(t-1));

x = x1 .* x2;
plot(t,x);
hold on;

wl = linspace(-3*pi,-pi);
Xl = j/(2*pi)*(exp(-j*(pi+wl))-1);
wm = linspace(-pi,pi);
Xm = j/(2*pi)*(exp(-j*(pi+wm)) - exp(-j*(-pi+wm)));
wr = linspace(pi,3*pi);
Xr = j/(2*pi)*(1-exp(-j*(pi+wr)));

X = [Xl Xm Xr];
w = [wl wm wr];
dw = w(2)-w(1);

y = zeros(1,length(x));

for k = 1:length(w)
    y = y + X(k)*exp(j*w(k)*t)*dw;
end

plot(t,y/(2*pi),'ro');