It is not my intention to sound “teaching”, but it may be really useful (and more fun) if you take the MATLAB code and try to translate it to Python yourself. Don’t worry about the result being less than optimal: You can improve and ask specific questions when you are stuck with programming.
Regarding speed in Python, it may be that a naive implementation without any further tweaks will not be much of an improvement over MATLAB. However, you may find this post from the front page and, more specifically, this lecture interesting. (Although I am not such a JIT fan, the lecture is very worthwhile.)