%
% FUNCTION 7.3 : "cp0702_analytical_waveforms"
%
% Definition of the analytical expression for the first 15
% derivatives of the Gaussian pulse
%
% The function receives as input:
% 1) the time axis vector 't'
% 2) the order of the derivative 'k'
% 3) the value of the shape factor 'alpha'
%
% The function returns the vector representing the
% derivative of order 'k' of the Gaussian pulse calculated
% over the time axis 't'
%
% Programmed by Luca De Nardis
function [deriv] = cp0702_analytical_waveforms(t,k,alpha)
switch(k)
case 1
deriv = 4*pi*t/alpha^2.*exp(-2*pi*t.^2/alpha^2);
case 2
deriv = -4*pi*exp(-2*pi*(t.^2)/alpha^2).*...
(-alpha^2+4*pi*(t.^2))/alpha^4;
case 3
deriv = 16*pi^2*t.*exp(-2*pi*(t.^2)/alpha^2).*...
(-3*alpha^2+4*pi*(t.^2))/alpha^6;
case 4
deriv = -16*pi^2*exp(-2*pi*(t.^2)/alpha^2).*...
(3*alpha^4-24*pi*(t.^2)*alpha^2+16*pi^2*...
(t.^4))/alpha^8;
case 5
deriv = 64*pi^3*t.*exp(-2*pi*(t.^2)/alpha^2).*...
(15*alpha^4-40*pi*(t.^2)*alpha^2+16*pi^2*...
(t.^4))/alpha^10;
case 6
deriv = -64*pi^3*exp(-2*pi*(t.^2)/alpha^2).*...
(-15*alpha^6+180*pi*(t.^2)*alpha^4-240*...
pi^2*(t.^4)*alpha^2+64*pi^3*(t.^6))/alpha^12;
case 7
deriv = 256*pi^4*t.*exp(-2*pi*(t.^2)/alpha^2).*...
(-105*alpha^6+420*pi*(t.^2)*alpha^4-336*pi^2*...
(t.^4)*alpha^2+64*pi^3*(t.^6))/alpha^14;
case 8
deriv = -256*pi^4*exp(-2*pi*(t.^2)/alpha^2).*...
(105*alpha^8-1680*pi*(t.^2)*alpha^6+3360*pi^2*...
(t.^4)*alpha^4-1792*pi^3*(t.^6)*alpha^2+...
256*pi^4*(t.^8))/alpha^16;
case 9
deriv = 1024*pi^5*t.*exp(-2*pi*(t.^2)/alpha^2).*...
(945*alpha^8-5040*pi*(t.^2)*alpha^6+6048*pi^2*...
(t.^4)*alpha^4-2304*pi^3*(t.^6)*alpha^2+256*...
pi^4*(t.^8))/alpha^18;
case 10
deriv = -1024*pi^5*exp(-2*pi*(t.^2)/alpha^2).*...
(-945*alpha^10+18900*pi*(t.^2)*alpha^8-50400*...
pi^2*(t.^4)*alpha^6+40320*pi^3*(t.^6)*....
alpha^4-11520*pi^4*(t.^8)*alpha^2+1024*pi^5*...
(t.^10))/alpha^20;
case 11
deriv = 4096*pi^6*t.*exp(-2*pi*(t.^2)/alpha^2).*...
(-10395*alpha^10+69300*pi*(t.^2)*alpha^8-...
110880*pi^2*(t.^4)*alpha^6+63360*pi^3*(t.^6)*...
alpha^4-14080*pi^4*(t.^8)*alpha^2+1024*pi^5*...
(t.^10))/alpha^22;
case 12
deriv = -4096*pi^6*exp(-2*pi*(t.^2)/alpha^2).*...
(10395*alpha^12-249480*pi*(t.^2)*alpha^10+...
831600*pi^2*(t.^4)*alpha^8-887040*pi^3*(t.^6)*...
alpha^6+380160*pi^4*(t.^8)*alpha^4-67584*pi^5*...
(t.^10)*alpha^2+4096*pi^6*(t.^12))/alpha^24;
case 13
deriv = 16384*pi^7*t.*exp(-2*pi*(t.^2)/alpha^2)...
.*(135135*alpha^12-1081080*pi*(t.^2)*alpha^10+...
2162160*pi^2*(t.^4)*alpha^8-1647360*pi^3*...
(t.^6)*alpha^6+549120*pi^4*(t.^8)*alpha^4-...
79872*pi^5*(t.^10)*alpha^2+4096*pi^6*...
(t.^12))/alpha^26;
case 14
deriv = -16384*pi^7*exp(-2*pi*(t.^2)/alpha^2).*...
(-135135*alpha^14+3783780*pi*(t.^2)*alpha^12-...
15135120*pi^2*(t.^4)*alpha^10+20180160*pi^3*...
(t.^6)*alpha^8-11531520*pi^4*(t.^8)*alpha^6+...
3075072*pi^5*(t.^10)*alpha^4-372736*pi^6*...
(t.^12)*alpha^2+16384*pi^7*(t.^14))/alpha^28;
case 15
deriv = 65536*pi^8*t.*exp(-2*pi*(t.^2)/alpha...
^2).*(-2027025*alpha^14+18918900*pi*(t.^2)*...
alpha^12-45405360*pi^2*(t.^4)*alpha^10+...
43243200*pi^3*(t.^6)*alpha^8-19219200*pi^4*...
(t.^8)*alpha^6+4193280*pi^5*(t.^10)*alpha^4-...
430080*pi^6*(t.^12)*alpha^2+16384*pi^7*...
(t.^14))/alpha^30;
end