%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Rising sine wave
% Carlos J. Cela, March 2012
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all
clear all

freq = 1e6;
amplitude = 1000;

maxT =50;

c0 = 3e8;
omega = 2*pi*freq;
lambda=c0/freq;
ddx = lambda/20;
dt = ddx/(2*c0);

np = (2.*3.e8)/(freq*ddx); % number of time steps per cycle

for T=1:maxT
  if(T<np/2.)
    pulse(T) = 0.5*(1-cos(2*pi*freq*T*dt))*amplitude*sin(2*pi*freq*T*dt);
  else
    pulse(T) = amplitude.*sin(2*pi*freq*T*dt);
  end;
end

plot(1:maxT,pulse,'linewidth',2)
