Not sure if you are looking for a clearer introduction to RBM or just an example.
If you prefer to have a look at an actual implementation, I have implemented the RBM in Matlab because I found existing implementations to lack modularity for my own needs. You can find it here: https://github.com/pixelou/nnbox/blob/master/networks/RBM.m (pretrain method starts at line 119). I cannot guaranty that it is bug free though :-)
For a comprehensive introduction to Restricted boltzmann machines, you can have a look at Training restricted Boltzmann machines: An introduction from Asja Fischer & Christian Igel, this is the clearest paper in terms of proofs and structure. But I found it a bit hard to follow on the first read so you can instead split your reading into several stages:
1 - consider the problem of learning a model (RBM) as a minimization of the distance between the parametric pdf of the RBM and the underlying dataset distribution.
2 - compute the gradient of the distance so that you can do gradient descent
I have detailed the computation here: How to derive the gradient formula for the Maximum Likelihood in RBM?
3 - notice that you cannot compute that expression because one part is intractable :-). Use Contrastive divergence (or any other method but CD is the most popular) to approximate this value. You can read A New Learning Algorithm for Mean Field Boltzmann Machines from Welling & Hinton (2001) which is one of the early publications on CD.
4 - Use that gradient to perform gradient update, adjust with regularization and tricks. For that matter, a Practical Guide to Training Restricted Boltzmann Machines from Hinton (2010) is a must read.