function[]=mcmcprog(m) A = [1,3,5];f = [0.01,0.03,0.05];phi = [0,0,0]; sigma = 1; time = 100; % no. of time steps actualdatphi(A,f,phi,sigma,time); % to set the starting values loop over i. for i = 1:m AMP(i)=1;freq(i)=0.01;phase(i)=0; end % start the iterations for k = 1:50000 % A,f and phi will contain the MCMC chains. % set their values at the begginning to the last value of AMP,freq and % phi A(k,:)=AMP;f(k,:)=freq;phi(k,:)=phase; for z = 1:m [AMP,freq,phase] = mcmc(A(k,z),f(k,z),phi(k,z),AMP,freq,phase,z,k); end % mcmc has been used to find the new values of AMP, freq and phase k end save('A.txt','A','-ascii') save('f.txt','f','-ascii') save('phi.txt','phi','-ascii')