%	templateh02_1.m
% 
% search through script and replace all ?? with appropriate command
% also requires fwhm script
%

	f0 = 1.5;	% MHz
	beta = 0.1;	% /MHz /cm	for 1dB/cm/MHz

	%
	%	sample points for amplitude in time domain
	%
	n = 256;
        sampspace = 40/f0/n;   % microsec
	ii = [0:(n-1)]'-n/2;
	tt = ii*sampspace;	%  time vector 

	for cs =1:2
		%
		%	assign a(t), the amplitude function
		%
		if cs  == 1
			at = abs(tt*f0/3) < 0.5;	% rect(t*f0/3)
		else
			%	you make a gaussian
			at = ??
		end

		%	look at your amplitude function
		clf, plot(tt, at);
		xlabel('t [usec]')
		ylabel('a(t)')
		disp 'hit key'; pause

		%
		%	compute spectrum of amplitude function
		%
		af = ft(at);

		%
		%	determine frequency samples units (MHz)
		%
		fs = ??

		%	plot spectrum
		plot(fs, abs(af));
		xlabel('f [MHz]')
		ylabel('Pulse Amplitude Spectrum A(f)')
		disp 'hit key'; pause

		%
		%	loop over different depths
		%
		zlist = [0 4 8 12];
		clf
		for iz = 1:length(zlist)
			subplot(2,2,iz)
			z = zlist(iz);		% which depth

			%
			%	compute attenuation effects
			%	ie, DFT of dispersed pulse
			%
			%       compute attenuation function in freq domain
			adf = ??

			%	go back to time domain
			adt = ??

			%
			%	normalize to unit height for plotting
			%
			adt = adt / max(abs(adt));

			adt = abs(adt);		% envelope
			plot(tt, adt, 'x', tt, at, '-')
			axis([-10 10 0 1.6])
			xlabel('t [microsec]')
			ylabel('v(t) with dispersion')
			title(sprintf('z = %g cm', z))
		end
		disp 'hit key'; pause
	end
