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

📄 mkdiff.c

📁 seismic software,very useful
💻 C
字号:
/* Copyright (c) Colorado School of Mines, 1990./* All rights reserved.                       *//*FUNCTION:  make discrete Taylor series approximation to n'th derivativePARAMETERS:n			i order of desired derivative (n>=0 && n<=m-l is required)a			i fractional distance from integer sampling index (see notes)h			i sampling intervall			i sampling index of first coefficient (see notes below)m			i sampling index of last coefficient (see notes below)d			o array of coefficients for n'th order differentiatorNOTES:The abscissae x of a smpled function f(x) can always be expressed asx = (j+a)*h, where j is an integer, a is a fraction, and h is thesampling interval.  To approximate the n'th order derivative fn(x)of the sampled function f(x) at x = (j+a)*h, use the m-l+1 coefficientsin the output array d[] as follows:	fn(x) = d[0]*f(j-l) + d[1]*f(j-l-1) +...+ d[m-l]*f(j-m)i.e., convolve the coefficients in d with the samples in f.m-l+1 (the number of coefficients) must not be greater than theNCMAX parameter specified below.For best approximations,when n is even, use a = 0.0, l = -mwhen n is odd, use a = 0.5, l = -m-1AUTHOR:  Dave Hale, Colorado School of Mines, 06/02/89*/#include "cwp.h"#define NCMAX 100void mkdiff (int n, float a, float h, int l, int m, float d[]){	int nc,i;	double fn,hn,v[NCMAX],b[NCMAX];	/* determine number of coefficients */	nc = m-l+1;	/* build Vandermonde system of equations */	for (i=0; i<nc; i++) {		v[i] = -(l+i)-a;		b[i] = 0.0;	}	for (i=1,fn=hn=1.0; i<=n; i++) {		fn *= i;		hn *= h;	}	b[n] = fn/hn;	/* compute coefficients in double precision */	vanded(nc,v,b,b);	/* copy coefficients to output array */	for (i=0; i<nc; i++)		d[i] = b[i];}

⌨️ 快捷键说明

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