%  File:  noisyDataLine.m
%
%  Generate a function and add noise to it.  Plot the function
%  as a solid line and the noisy data as open circles

x = 0:0.01:2;                 %  generate the x-vector
y = 5*x.*exp(-3*x);           %  and the "true" function, y
yn = y + 0.02*randn(size(x)); %  Create a noisy version of y
plot(x,y,'-',x,yn,'ro');      %  Plot the true and the noisy

xlabel('x (arbitrary units)');          %  add axis labels and plot title
ylabel('y (arbitrary units)');
title('Plot of y = 5*x*exp(-3*x) + noise');
legend('true y','noisy y');
