thao=1;
xt=@(t)(t>=-thao).*(t<=thao);
%xt=@(t)(t>=-1).*(t<0).*(t+1)+(t>=0).*(t<=1).*(-t+1);
t=-30:0.01:30;
plot(t,xt(t))
axis([-3 3 -2.3 2.3])
w=-30:0.01:30;
xw=[];
for i=w
    int=(xt(t)).*exp(-j*i*t);
xw=[xw trapz(t,int)];
end
figure(2)
plot(w,(1/(2*pi)*xw))

