00001 /* ======== IGeoS ===== Distribition full ===== IGeoS ========= 00002 ** 00003 ** butterworth.h: Created by 'AMSS-developer' on Fri Jan 12 19:49:03 2018 00004 ** 00005 ** Product : IGeoS - Integrated Geoscience Software 00006 ** 00007 ** Description : System for seismic, well log, and potential-field data analysis 00008 ** 00009 ** =================== Limited License: =================================== 00010 ** 00011 ** This software is provided free under the following terms and conditions: 00012 ** 00013 ** 1. Permission to use, copy, and modify this software 00014 ** for non-commercial purposes without fee is hereby granted, provided 00015 ** that this copyright notice, the warranty disclaimer, and this 00016 ** permission notice appear in all copies. 00017 ** 00018 ** 2. Distribution of this software or any part of it "bundled" in with 00019 ** any product is considered to be a 'commercial purpose'. 00020 ** 00021 ** 3. Any new or adapted code developed to operate as a part of this 00022 ** software shall be contributed to the authors and distributed under 00023 ** the same license. 00024 ** 00025 ** ================== Warranty Disclaimer: ================================ 00026 ** 00027 ** This software is provided "as is", with no support and without 00028 ** obligation on the part of the author to assist in its use, correction, 00029 ** modification, or enhancement. No guarantees or warranties, 00030 ** either express or implied, and regarding the accuracy, safety, or 00031 ** fitness for any particular purpose are provided by any contributor 00032 ** to this software package. 00033 ** 00034 ** ======== IGeoS ===== Distribition full ===== IGeoS ========= */ 00035 00036 /******** Butterworth filters derived from Seismic UNIX *******************/ 00037 00038 /* Copyright (c) Colorado School of Mines, 1997.*/ 00039 /* All rights reserved. */ 00040 00041 /*********************** self documentation **********************/ 00042 /***************************************************************************** 00043 BUTTERWORTH - Functions to design and apply Butterworth filters: 00044 00045 FILTER_bfdesign design a Butterworth filter 00046 FILTER_bfhighpass apply a high-pass Butterworth filter 00047 FILTER_bflowpass apply a low-pass Butterworth filter 00048 00049 ****************************************************************************** 00050 Function Prototypes: 00051 */ 00052 00053 void FILTER_bfhighpass (int npoles, DATA_SAMPLE f3db, int n, 00054 DATA_SAMPLE p[], DATA_SAMPLE q[]); 00055 void FILTER_bflowpass (int npoles, DATA_SAMPLE f3db, int n, 00056 DATA_SAMPLE p[], DATA_SAMPLE q[]); 00057 void FILTER_bfdesign (DATA_SAMPLE fpass, DATA_SAMPLE apass, 00058 DATA_SAMPLE fstop, DATA_SAMPLE astop, 00059 int *npoles, DATA_SAMPLE *f3db); 00060 00061 /* 00062 ****************************************************************************** 00063 FILTER_bfdesign: 00064 Input: 00065 fpass frequency in pass band at which amplitude is >= apass 00066 apass amplitude in pass band corresponding to frequency fpass 00067 fstop frequency in stop band at which amplitude is <= astop 00068 astop amplitude in stop band corresponding to frequency fstop 00069 00070 Output: 00071 npoles number of poles 00072 f3db frequency at which amplitude is sqrt(0.5) (-3 db) 00073 00074 FILTER_bfhighpass and FILTER_bflowpass: 00075 Input: 00076 npoles number of poles (and zeros); npoles>=0 is required 00077 f3db 3 db frequency; nyquist = 0.5; 0.0<=f3db<=0.5 is required 00078 n length of p and q 00079 p array[n] to be filtered 00080 00081 Output: 00082 q filtered array[n] (may be equivalent to p) 00083 00084 ****************************************************************************** 00085 Notes: 00086 (1) Nyquist frequency equals 0.5 00087 00088 (2) The following conditions must be true: 00089 (0.0<fpass && fpass<0.5) && 00090 (0.0<fstop && fstop<0.5) && 00091 (fpass!=fstop) && 00092 (0.0<astop && astop<apass && apass<1.0) 00093 00094 (3) if (fpass<fstop) 00095 00096 FILTER_bfdesign: 00097 Butterworth filter: compute number of poles and -3 db frequency 00098 for a low-pass or high-pass filter, given a frequency response 00099 constrained at two frequencies. 00100 00101 ****************************************************************************** 00102 Author: Dave Hale, Colorado School of Mines, 06/02/89 00103 *****************************************************************************/ 00104 /**************** end self doc ********************************/