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

📄 ifftrl.m

📁 地震解释处理matlab工具箱
💻 M
字号:
function [r,t]= ifftrl(spec,f)
% IFFTRL inverse Fourier transform for real time series
%
% [r,t]= ifftrl(spec,f)
%
% Inverse fourier transform to a real trace. The spectrum is
% assumed to be of length floor(n/2+1) where n is the length of the time
% series to be created. (This is automatically the case if it was created by
% fftrl. This is a slightly ambiguous situation since, for
% example, time series of length 4 and length 5 will both result in 3
% frequency samples. However, only the first case will have a sample at
% Nyquist. Since the sample at Nyquist should be purely real, the algorithm
% tests the sample spec(end) for a nonzero imaginary part. If a zero
% imaginary part is found, it is assumed to be a sample at Nyquist. So, a
% problem could arise if the spectrum has been altered such that the
% Nyquist is no longer purely real.
%
% spec= input spectrum
% f= input frequency sample vector 
% r= output trace
% t= output time vector
%
% by G.F. Margrave, May 1991
%
% NOTE: It is illegal for you to use this software for a purpose other
% than non-profit education or research UNLESS you are employed by a CREWES
% Project sponsor. By using this software, you are agreeing to the terms
% detailed in this software's Matlab source file.
 
% BEGIN TERMS OF USE LICENSE
%
% This SOFTWARE is maintained by the CREWES Project at the Department
% of Geology and Geophysics of the University of Calgary, Calgary,
% Alberta, Canada.  The copyright and ownership is jointly held by 
% its author (identified above) and the CREWES Project.  The CREWES 
% project may be contacted via email at:  crewesinfo@crewes.org
% 
% The term 'SOFTWARE' refers to the Matlab source code, translations to
% any other computer language, or object code
%
% Terms of use of this SOFTWARE
%
% 1) Use of this SOFTWARE by any for-profit commercial organization is
%    expressly forbidden unless said organization is a CREWES Project
%    Sponsor.
%
% 2) A CREWES Project sponsor may use this SOFTWARE under the terms of the 
%    CREWES Project Sponsorship agreement.
%
% 3) A student or employee of a non-profit educational institution may 
%    use this SOFTWARE subject to the following terms and conditions:
%    - this SOFTWARE is for teaching or research purposes only.
%    - this SOFTWARE may be distributed to other students or researchers 
%      provided that these license terms are included.
%    - reselling the SOFTWARE, or including it or any portion of it, in any
%      software that will be resold is expressly forbidden.
%    - transfering the SOFTWARE in any form to a commercial firm or any 
%      other for-profit organization is expressly forbidden.
%
% END TERMS OF USE LICENSE

%test for matrix or vector
[m,n]=size(spec);
itr=0;
if( ~(m-1)*(n-1) )
	if(m==1) spec=spec.'; itr=1; end
	nsamp=length(spec);
	ntr=1;
else
	nsamp=m;
	ntr=n;
end

% form the conjugate symmetric complex spectrum expected by ifft
%test for presence of nyquist
nyq=0;
if(isreal(spec(end))) nyq=1; end
if(nyq)
    L1=1:nsamp;L2=nsamp-1:-1:2;
else
    L1=1:nsamp; L2=nsamp:-1:2;
end
symspec=[spec(L1,:);conj(spec(L2,:))];

% transform the array
 r=real(ifft(symspec));

% build the time vector
 n=length(r);
 df=f(2)-f(1);
 dt=1/(n*df);
 %dt=1./(2*f(length(f)));
 %tmax=size(r,1)*dt;
 %t=linspace(0.,tmax,size(r,1));
 t=dt*(0:n-1)';
 
 if(itr==1)
 	r=r.';
    t=t';
 end

⌨️ 快捷键说明

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