📄 fkfilt.m,v
字号:
head 3.0;access;symbols;locks; strict;comment @// @;3.0date 2000.06.13.19.19.21; author gilles; state Exp;branches;next 2.0;2.0date 99.05.21.18.44.44; author mah; state Exp;branches;next 1.1;1.1date 99.01.06.19.08.49; author kay; state Exp;branches;next ;desc@@3.0log@Release 3@text@function [dataout]=fkfilt(datain,poly,freq,taper,filtflg,dx,rec)%[dataout]=fkfilt(datain,poly,freq,taper,filtflg,dx,rec)%%F-K Filter%Does not loop over records.%%datain = input data in DSI format%poly = x,y coordinates of the corners of filter polygone% use 'fkpoly' to pick polygone%freq = maximum frequency in the data (Hz)%taper = taper to be used around polygone%filtflg =1 for reject% =0 for pass%dx = distance between traces (m) used to compute wave number%rec = record number to be filtered%%DSI customized VSP processing software%developed by G. Perron%$Id: fkfilt.m,v 2.0 1999/05/21 18:44:44 mah Exp gilles $%$Log: fkfilt.m,v $%Revision 2.0 1999/05/21 18:44:44 mah%Release 2%%Revision 1.1 1999/01/06 19:08:49 kay%Initial revision%%%Copyright (C) 1998 Seismology and Electromagnetic Section/%Continental Geosciences Division/Geological Survey of Canada%%This library is free software; you can redistribute it and/or%modify it under the terms of the GNU Library General Public%License as published by the Free Software Foundation; either%version 2 of the License, or (at your option) any later version.%%This library is distributed in the hope that it will be useful,%but WITHOUT ANY WARRANTY; without even the implied warranty of%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU%Library General Public License for more details.%%You should have received a copy of the GNU Library General Public%License along with this library; if not, write to the%Free Software Foundation, Inc., 59 Temple Place - Suite 330,%Boston, MA 02111-1307, USA.%%DSI Consortium%Continental Geosciences Division%Geological Survey of Canada%615 Booth St.%Ottawa, Ontario%K1A 0E9%%email: dsi@@cg.nrcan.gc.cadisp('[dataout]=fkfilt(datain,poly,freq,taper,filtflg,dx,rec)');dataout=datain;int=datain.fh{8}; %sampling interval (s)datain=datain.dat{rec};%----------finding nextpow2-------------[m,n]=size(datain);m2=2^nextpow2(m);n2=2^nextpow2(n);if filtflg==0 matfilt=zeros(m2,n2); %initializing filter matrixelseif filtflg==1 matfilt=ones(m2,n2); %initializing filter matrixendkn=1/(2*dx); %Nyquist wavenumberfn=1/(2*int); %Nyquist frequencyx=[kn:-kn*2/n2:-kn+kn*2/n2];y=fliplr([0:2*fn/m2:freq]);[xmat,ymat]=meshgrid(x,y); %creating polymatrix%-------------computing fft---------------fkdata=fft2(datain,m2,n2);fkdata=fftshift(fkdata);%--------finding points in polygon---------in=inpolygon(xmat,ymat,poly(:,1),poly(:,2));%-------------mean filtering---------------nfreq=length(y);[a,b]=size(in);for i=1:a in(i,:)=meanfilt(in(i,:),taper);endfor i=1:b in(:,i)=meanfilt(in(:,i),taper);end%---------inverting filter matrix----------if filtflg==1 in=1-in;end%--------creating mirror filt matrix-------flipin=flipud(fliplr(in));%---------creating filter matrix------------matfilt(m2/2-nfreq+1:m2/2,:)=in;matfilt(m2/2:m2/2+nfreq-1,:)=flipin;clear xmat ymat in datain%---------------filtering--------------------fd=fkdata.*matfilt;clear matfilt%---------computing inverse fft--------------fd=fftshift(fd);dataout.dat{rec}=ifft2(fd);dataout.dat{rec}=real(dataout.dat{rec}(1:m,1:n));@2.0log@Release 2@text@d21 1a21 1%$Id: fkfilt.m,v 1.1 1999/01/06 19:08:49 kay Exp mah $d23 3@1.1log@Initial revision@text@d21 4a24 2%$Id:$%$Log:$d26 1@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -