
% Lab 9 Solutions
% CS 1109, Summer 2011
% July 26

function messySine(a)
%
% messySine: This function plots the messySine function
%
%   This function accepts a single input parameter a and plots the function
%   y = a * e^(-x) * sin(x) / ceil(x) over the interval [2*pi, 4*pi].
%

% Compute (x, y) pairs for the interval [2*pi, 4*pi]
x = 2*pi : 0.1 : 4*pi;
y = a * exp(-x) .* sin(x) ./ ceil(x);

% Plot the function and set the axis and title properties
plot(x, y);
xlabel('Value of x');
ylabel('Value of y');
titleString = sprintf('y(x) = %.2f * exp(-x) * sin(x) / ceil(x)', a);
title(titleString);

end

