1import matlab.engine
2eng = matlab.engine.start_matlab()
3eng.mscriptname(nargout=0)
4
1newFile = fullfile(tmp,'ANewFile.m');
2function [p] = randwalk(p, q, j, k)
3 if p + q < 1
4 c = 0.5;
5 else
6 c = 1;
7 end
8 mean = p - q;
9 sd = sqrt (p + q - (p - q)^2);
10 p = normcdf((k + c - n*mean)/(sd * sqrt(n))) - normcdf((j - c
11- n*mean)/(sd * sqrt(n)));
12end