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

📄 mksinc.c

📁 seismic software,very useful
💻 C
字号:
/* Copyright (c) Colorado School of Mines, 1990./* All rights reserved.                       *//*FUNCTION:  compute least-squares optimal sinc interpolation coefficientsPARAMETERS:d			i fractional distance to interpolation point; 0.0<=d<=1.0lsinc		i length of sinc approximation; lsinc%2==0 and lsinc<=20sinc		o array containing lsinc interpolation coefficientsNOTES:The coefficients are a least-squares-best approximation to the idealsinc function for frequencies from zero up to a computed maximumfrequency.  For a given interpolator length, lsinc, mksinc computesthe maximum frequency, fmax (expressed as a fraction of the nyquistfrequency), using the following empirically derived relation (froma Western Geophysical Technical Memorandum by Ken Larner):	fmax = min(0.066+0.265*log(lsinc),1.0)Note that fmax increases as lsinc increases, up to a maximum of 1.0.Use the coefficients to interpolate a uniformly-sampled function y(i) as follows:            lsinc-1    y(i+d) =  sum  sinc[j]*y(i+j+1-lsinc/2)              j=0Interpolation error is greatest for d=0.5, but for frequencies lessthan fmax, the error should be less than 1.0 percent.AUTHOR:  Dave Hale, Colorado School of Mines, 06/02/89*/#include "cwp.h"void mksinc (float d, int lsinc, float sinc[]){	int j;	double s[20],a[20],c[20],work[20],fmax;	/* compute auto-correlation and cross-correlation arrays */	fmax = 0.066+0.265*log((double)lsinc);	fmax = (fmax<1.0)?fmax:1.0;	for (j=0; j<lsinc; j++) {		a[j] = dsinc(fmax*j);		c[j] = dsinc(fmax*(lsinc/2-j-1+d));	}	/* solve symmetric Toeplitz system for the sinc approximation */	stoepd(lsinc,a,c,s,work);	for (j=0; j<lsinc; j++)		sinc[j] = s[j];}

⌨️ 快捷键说明

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