% This program aims at making you familiar with the convolution concept and % the equivalence of convolution in space-time and spectral domains clear close all % Let us generate a theoretical "Green's function" for example, a time % signal with one arrival of a certain amplitude at a certain time dt=.01; t=0:dt:10; % time between 0 and 10 seconds with sampling of 10 Hz s=(1:length(t))*0; s(250)=1; subplot(3,1,1) plot(t,s) %xlabel(' Time (s) ') ylabel(' Amplitude ') title(' Greens function ') % Now let us generate an "arbitrary input signal", here we choose the first % derivative of a Gaussian sigma=.2; t0=1; src=exp(-1/sigma^2*(t-t0).*(t-t0)); src=diff(src)/dt % simple finite differencing! subplot(3,1,2) plot(t(1:length(src)),src) %xlabel(' Time (s) ') ylabel(' Amplitude ') title(' Input signal ') % Now let us convolve the Green's function with the src cs=conv(s,src); % Note that the signal is now much longer but we only look at the original % seismogram length subplot(3,1,3) plot(t,cs(1:length(t))) xlabel(' Time (s) ') ylabel(' Amplitude ') title(' Response of the system ')