⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s_convolve.m

📁 实现地震勘探中
💻 M
字号:
function seismic=s_convolve(seisin1,seisin2,varargin)% Function convolves two seismic data sets% If one of the data sets has only one trace then it is convolved with all % traces of the other data set.% The headers of the dataset with more traces are retained.% If the datasets have the same number of traces, corresponding traces are% convolved, and the headers of the first data set are retained.%% Written by: E. R.: April 2000% Last updated: April 2, 2008: Check for trace nulls in the output dataset%%              seismic=s_convolve(seisin1,seisin2,varargin)% INPUT% seisin1     first seismic input dataset% seisin2     second seismic input dataset% varargin    one or more cell arrays; the first element of each cell array is a keyword,%             the other elements are parameters. Presently, keywords are:%             Options not yet implemented % OUTPUT% seismic     output dataset; convolution of the two input datasets% UPDATE HISTORY%             January 22, 2007: Preserve precision of input argumentsif ~istype(seisin1,'seismic')  ||  ~istype(seisin2,'seismic')   error('The first two input arguments must be seismic datasets.')end[nsamp1,ntr1]=size(seisin1.traces);[nsamp2,ntr2]=size(seisin2.traces);%	Set defaults for input argumentsif ntr1 >= ntr2   param.header=1;else   param.header=2;endparam.type='corresponding';%	Replace defaults by actual input arguments (if there are any)param=assign_input(param,varargin); %       Error checkingif isnull(seisin1)   disp('The first seismic input dataset has one or more traces with null values.')   disp('This may create a large number of null values in the output data set.')   warning(warnid,'If this is not intended remove them with "s_rm_trace_nulls".')endif isnull(seisin2)   disp('The second seismic input dataset has one or more traces with null values.')   disp('This may create a large number of null values in the output data set.')   warning(warnid,'If this is not intended remove them with "s_rm_trace_nulls".')endseismic.first=seisin1.first+seisin2.first;seismic.last=seisin1.last+seisin2.last;if seisin1.step == seisin2.step   seismic.step=seisin1.step;else   error([' The two input data sets have different sample intervals (', ...         num2str(seisin1.step),' vs. ',num2str(seisin2.step),')'])end%	Handle precision requirementif strcmp(class(seisin1.traces),'single')  ||  strcmp(class(seisin2.traces),'single')    seismic.traces=zeros(nsamp1+nsamp2-1,max([ntr1,ntr2]),'single');else   seismic.traces=zeros(nsamp1+nsamp2-1,max([ntr1,ntr2]));endif ntr1 == 1   for ii=1:ntr2      seismic.traces(:,ii)=conv(seisin1.traces,seisin2.traces(:,ii));   endelseif ntr2 == 1   for ii=1:ntr1      seismic.traces(:,ii)=conv(seisin2.traces,seisin1.traces(:,ii));   end   elseif ntr1 == ntr2    if strcmpi(param.type,'corresponding')      for ii=1:ntr1         seismic.traces(:,ii)=conv(seisin2.traces(:,ii),seisin1.traces(:,ii));      end   endelse   error('This option has not yet been implemented')end%    Append history field and copy rest of fieldsif param.header == 1%       Copy rest of fields   seismic=copy_fields(seisin1,seismic);   if isfield(seisin1,'history')  &&  isfield(seisin2,'history')      seismic=s_history(seismic,'append',' ');      seismic=s_history(seismic,'merge',seisin2.history);   endelse%       Copy rest of fields   seismic=copy_fields(seisin2,seismic);   if isfield(seisin1,'history')  &&  isfield(seisin2,'history')      seismic=s_history(seismic,'append',' ');      seismic=s_history(seismic,'merge',seisin1.history);   endend%     Check for null values and set field "null" accordinglyif any(isnan(seismic.traces(:)))   seismic.null=NaN;else   seismic.null=[];end    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -