% This program provides a simple example of using an "if" statement in
% Matlab.  The problem statement is:
%
%   Create a MATLAB script to plot cos(x) an sin(x) on a
%   user-specified interval.  The user should be able to
%   enter the interval in degrees or radians. 
%
clear;
clc;
close all;

% determine if we will have input in degrees or radians:
degrad = input('Degrees (1) or radians (2)? ');

% get the lower and upper bounds for plotting:
lo = input('lower bound: ');
hi = input('upper bound: ');

% if we have degrees, convert to radians...
if( degrad == 1 )
  lo = lo * pi/180;
  hi = hi * pi/180;
end


x = linspace(lo,hi);
plot(x,cos(x),'k--',x,sin(x),'r-');