% ===========================
% ===== Spherical Waves =====
% ===========================

clc
clear

Amplitude=2;

WaveNumber=3;
DistanceFromSource=9;

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

for k=1:50
   
	Signal(k,1:length(Time))=Amplitude*real((2.71828.^(i*(WaveNumber*DistanceFromSource-AngularFrequency*Time)./DistanceFromSource)));
   DistanceFromSource=DistanceFromSource+1;
   
end

figure(1);
PropagationParameter=[1:1:k];
PropagationEvolution=Signal(PropagationParameter,:);
mesh(Time,PropagationParameter,PropagationEvolution);
h1=mesh(Time,PropagationParameter,PropagationEvolution);
set(h1,'MeshStyle','row');
title('Cross Section of a Spherical Wave (The Source Point is Located at Distance = 0)');
xlabel('Distance');
ylabel('Time');
zlabel('Amplitude');
hidden off
