clear all h = 2/100; L = input('L = '); for i = 1:101 x = -1 + i*h; X(i) = x; for j = 1:101; y = -1 + j*h; Y(i) = y; C(i,j) = exp(-abs(x-y)/L)/(2*L); end end mesh(C) pause close all % % Better way to program the function. % [X,Y] = meshgrid(-1:.02:1); C = exp(-abs(X-Y)/L)/(2*L); mesh(X,Y,C)