There are a couple of different ways to do this. Do you have the Optimization Toolbox or Curve Fitting Toolbox? If so, type
at the Matlab prompt '>>' and see if the Optimization Toolbox or Curve Fitting Toolbox are listed. Both make this sort of thing quite a bit easier, and I would use these toolboxes if available.
If all you have is basic Matlab, you can do it like this:
expfn = @(p,xd) p(1)*exp(p(2)*xd);
errfn = @(p) sum((expfn(p,x)-y).^2);
pfit = fminsearch( errfn, [0 0]);
plot(x,y,'bo'); hold on;
plot(x, expfn(pfit, x), 'r-');
To understand this, you should search the documentation on anonymous functions and the 'fminsearch' function.