clc
clear

Amplitude=1;
SamplingRate=200;
Time=-5:1/SamplingRate:5;
Frequency=1;
AngularFrequency=2*pi*Frequency;

FrequencySeperation=1.25;

Beats=real(2*Amplitude*(2.71828.^(i.*AngularFrequency.*Time)).*-cos((FrequencySeperation/2).*Time));

figure(1);
subplot(2,1,1),plot(Time,Beats);
title('Beats Generation for Frequency Seperation of Delta = 1.25');
xlabel('Time');
ylabel('Amplitude');
grid on

BeatsIntensity=abs(real(2*Amplitude*(2.71828.^(i.*AngularFrequency.*Time)).*-cos((FrequencySeperation/2).*Time))).^2;

subplot(2,1,2),plot(Time,BeatsIntensity);
title('Beats Intensity for Frequency Seperation of Delta = 1.25');
xlabel('Time');
ylabel('Intensity (abs(Amplitude)^2)');
grid on