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

📄 hannhigh.m,v

📁 具有特色的地震数据处理源码
💻 M,V
字号:
head	3.0;access;symbols;locks; strict;comment	@// @;3.0date	2000.06.13.19.20.24;	author gilles;	state Exp;branches;next	2.0;2.0date	99.05.21.18.45.42;	author mah;	state Exp;branches;next	1.1;1.1date	99.01.25.21.56.45;	author mah;	state Exp;branches;next	;desc@performs a highpass finite impulse response (fir) filter using a hanning window@3.0log@Release 3@text@function [dataout]=hannhigh(datain,stopband,passband)%[dataout]=hannhigh(datain,stopband,passband)%%This function will filter your data using a highpass%Finite Impulse Response (FIR) filter where a hanning window%will be used.%'stopband' is the frequency in Hz of signal not transmitted%'passband' is the frequency in Hz of signal transmitted% W<Ws is not passed% W>Wp is passed% A hanning window will be used in order to give a % passband ripple of 3dB and a stopband ripple of 40dB in the power domain%% Warning: The program does not check for unreasonable parameters%%This is based off of the theory developed in%Digital Signal Processing by Alan V. Oppenheim & Ronald W. Schafer%%Written by Marko Mah January 1999%$Id: hannhigh.m,v 2.0 1999/05/21 18:45:42 mah Exp gilles $%$Log: hannhigh.m,v $%Revision 2.0  1999/05/21 18:45:42  mah%Release 2%%Revision 1.1  1999/01/25 21:56:45  mah%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.ca disp('[dataout]=hannhigh(datain,passband,stopband)')smpint=datain.fh{8}; %smpint is the sampling intervaltrclength=datain.fh{7}; %trclength is the trace lengthnrec=datain.fh{12}; %nrec is number of records is filedataout=datain;fsample=1/smpint; %fsample is the sampling freq. in HzWp=passband*2*pi/fsample; %normalized passband frequency in Rads/secWs=stopband*2*pi/fsample; %normalized stopband frequency in Rads/sec% transwidth is the transwidth of the filter% M is the order of the filtertranswidth=Wp-Ws;M=floor(6.2*pi/transwidth);M=2*(floor(M/2))+1; % this is to make sure M is odddisp('The order of the filter is:')MMhalf=(M-1)/2;n=[0:1:M-1];Wc=(Wp+Ws)/2; % Wc is the cutoff frequency%hd is the desired impulse response of the filter%eps is added in to make sure division by zero does not occurhd=(sin(pi*(n-Mhalf+eps))-sin(Wc*(n-Mhalf+eps)))./(pi*(n-Mhalf+eps));%w_hann is the hanning window or finite duration windoww_hann=0.5*(1-cos(2*pi*n/(M-1)));h=hd.*w_hann; %h is the impulse response of the hanning filterh=h'; %to put h in column format instead of row formatlencor=floor(length(h)/2); %length correction to the datapos=[lencor+1:1:trclength+lencor]; %is the position of the resultant data in the temp variablefor COUNT1=1:nrec [a,ntraces]=size(datain.dat{COUNT1}); %ntraces is the number of traces in the record for COUNT2=1:ntraces  temp=conv(datain.dat{COUNT1}(:,COUNT2),h); %convolves the highpass filter with the data  dataout.dat{COUNT1}(:,COUNT2)=temp(pos,1); %out puts the filtered data using the positions defined by pos end %for COUNT2end %for COUNT1@2.0log@Release 2@text@d22 1a22 1%$Id: hannhigh.m,v 1.1 1999/01/25 21:56:45 mah Exp mah $d24 3@1.1log@Initial revision@text@d22 4a25 2%$Id: Exp $%$Log: $d27 1@

⌨️ 快捷键说明

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