% Richard Duncan
% EE3133
% Assignment 2: 
% 1/22/98
%
% - generate the following signal:
%
%       x(t) = sin (2 * pi * 1.0 * t + pi/4 )
%
%               + sin (2 * pi * 1.5 * t + pi/3)
%
%   display a plot of the signal from t = [0, 1.0 secs]
%
%   is is periodic?
%

% ANS: 1 is clearly periodic. The combined signal has a period of 2
% seconds. The first component of the signal, x1 (f = 1 Hz), has a
% period of 1 second. The second component, x2(f = 1.5 Hz), has a
% period of 2/3 seconds. The two frequencies are commensurable, with
% f0 = 0.5 Hz, as f1 = 2 * f0 = 1.0 Hz, and f2 = 3 * f0 = 1.5 Hz. Since 
% f0 is the fundamental frequency at 0.5 Hz, and the period is 2
% secs. This has been verified graphically.

% - generate the following signal:
%
%       x(t) = sin (2 * pi * t + pi/4 )
%
%               + sin (2 * pi * sqrt(2) * t + pi/3)
%
%   display a plot of the signal from t = [0, 1.0 secs]
%
%   is it periodic?
%
% ANS: 2 is not periodic, as sqrt(2) is irrational. The period of that
% signal is sqrt(2)/2, and since the period of the other component is
% 1, the ratio of sqrt(2)/2::1 is not a rational number, hence the signal
% is aperiodic.

%
syms x1 x2 t
 
% Define the general sine functions
%
x1 = sin(2 * pi * 1.0 * t + pi/4) + sin (2 * pi * 1.5 * t + pi/3)
x2 = sin(2 * pi * t + pi/4) + sin (2 * pi * sqrt(2) * t + pi/3)
 
% Generate a linear vector of data, between 0 and 10 seconds, step  1ms
%
t = [0:0.001:10]
 
% plot the first signal
%
plot(t,eval(x1))
 
% open a new figure and plot the second signal
figure
plot(t,eval(x2))
 
% end of file
%
