% File: http://web.mit.edu/8.13/matlab/Examples/expdecay.m
% Date: 2008-June-13
% Author: Scott Sewell
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Simulating an exponential decay curve
% Useful for testing non-linear fitting routines
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=[0:20:2000];
y=100*exp(-.005*x);
noisyy=fix(y+sqrt(y).*randn(1,length(y)));
sig=sqrt(y);
errorbar(x,y,sig,'.');
title('Simulated Exponential Decay with Poisson Uncertainties');
xlabel('Bin');
ylabel('Counts');