% =========================================================================
%  ------  Metropolis Monte Carlo -------------
%
% This is an m-file that can be used as a template to develop Metropolis
% Monte Carlo algorithm for a system.  
%
% =========================================================================

% Clears history and command window 
close all; clear all;

% Parameters, Initialization of variables
n = ...; 
delta = ...;
mu = ...;
sigma = ...; 
x = zeros(1,n);
x(1)= ...;

% Main loop
for i=2:n

% Step 1: create proposal from a transition rule
  epsilon = ...;
  y = ...;

% Step 2: calculate r = min[1,pi(y)/pi(x)]
  r = ...;
  r = min(r,1);
  
% Step 3: accept or reject proposal
  u = rand(1);
  if u <= r % accept y
    x(i) = ...;
  else % reject y
    x(i) = ...;
  end
end

% Plot data
figure(1)
hist(x);
xlabel('this is a test: change label');
ylabel('this is a test: change label');


