% Beat Frequency and Aliasing

clc             % clear the command window
clear           % clear all variables
close all       % close any existing windows
format compact	% prevent extra blank lines in the output

T = 1;
a = 2*pi/T;
b = 0.9*a;
display ('F(t) = sin(a*t) + sin(b*t)');

% Plot non-aliased signal at a time increment of 0.01
delta_t = 0.01;
t = 0 : delta_t : 40;
f = sin(a*t) + sin(b*t);
plot (t, f)
title ('non-aliased signal');
xlabel('t_0.01');
ylabel('F(t)');

% Plot aliased signal at a time increment of 0.75
delta_t = 0.75;
figure      % open new figure window (to prevent previous from being lost)
t = 0 : delta_t : 40;
f = sin(a*t) + sin(b*t);
plot (t, f)
title ('aliased signal');
xlabel('t_0.75');
ylabel('F(t)');

disp 'Hit Enter to close all windows and quit'
pause
close all