%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   Compute the phase speed for
%   Explicit and Semi-Implicit Schemes.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear

%  kappa = k*Dx
%  mu = c*Dt/Dx
%  CC = C/c

%  Define a range of mu (avoid mu=0).
mu = linspace(0.01,5,110);

for kappa=pi/10:pi/10:pi
  CCexp = 1./(kappa*mu).*asin(mu*sin(kappa));
  CCimp = 1./(kappa*mu).*atan(mu*sin(kappa));
  
  figure(1); grid on; hold on
  plot(mu,real(CCexp),'b',mu,imag(CCexp),'r', ...
                          mu,abs(CCexp),'--g')
  xlabel('mu'); ylabel('C/c'); 
  title('Phase speed: Explicit scheme')
  pause
  
  figure(2); grid on; hold on
  plot(mu,real(CCimp),'b',mu,imag(CCimp),'r', ...
                          mu,abs(CCimp),'--g')
  xlabel('mu')
  ylabel('C/c')
  title('Phase speed: Implicit scheme')
  pause
end

% figure(1); hold off
% figure(2); hold off

close(1)
close(2)

return