% Solution Heat Equation with FT
% f(x) = 0, u(0,t) = e^(-t)
N1 = 201; N2 = 201;
tv = linspace(0,20,N1);
xv = linspace(0,10,N2);
[t1,x1] = ndgrid(tv,xv);
f = @(w,c) (2*w/pi).*(exp(-c(1)*w.^2)-...
    exp(-0.1*c(1)))./(0.1-w.^2);
for i = 1:N1
    for j = 1:N2
        c = [t1(i,j),x1(i,j)];        
        U(i,j) = integral(@(w)f(w,c).*sin(w*c(2)),0,50);
    end
end

set(gca,'FontSize',[12]);
surf(t1,x1,U);
shading interp
colormap(jet)
view([100 15])
xlabel('$t$','Fontsize',12,'interpreter','latex'); 
ylabel('$x$','Fontsize',12,'interpreter','latex'); 
zlabel('$u(x,t)$','Fontsize',12,'interpreter','latex');
axis tight

print -dpng pde_egmat.png	
print -deps pde_egmat.eps
