Simple MCMC Algorithm in Matlab

I would be really glad to get some specific advise on how to implement a simple MCMC algorithm (in Matlab, if possible). I'm not yet too familiar with optimization methods. My problem goes as follows:

The function $s(c_1,c_2)$ is a simulation which depends on the two constants $c_1$ and $c_2$, and $f(s(c_1,c_2))$ is the "goodness function" which determines the error of the simulation. This means I want $f$ small in the end. Furthermore, I have a range for both $c_1$ and $c_2$; all values in these ranges are assumed equally probable at the beginning.

Is there anything more one would need to know? My question is now if anyone can provide a simple algorithm or pseudo-algorithm for this specific problem. Thanks in advance.

• I could use the fmincon routine in Matlab for this particular problem which worked quite well to find a local minimum of my simulation. But I would still be interested on how to implement this using MCMC. – donald Jun 16 '15 at 13:40