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

📄 pp1d.c

📁 seismic software,very useful
💻 C
字号:
/* Copyright (c) Colorado School of Mines, 1990./* All rights reserved.                       *//*FUNCTION:  printer plot of a 1-dimensional arrayPARAMETERS:fp			i file pointer for output (e.g., stdout, stderr, etc.)title		i title of plotlx			i length of xifx			i index of first xx			i array to be plottedAUTHOR:  Dave Hale, Colorado School of Mines, 06/02/89*/#include "cwp.h"#define IFC 0#define ILC 60void pp1d (FILE *fp, char *title, int lx, int ifx, float x[]){	int ilx=ifx+lx-1,ix,ibase,icx,ic;	float xmin,xmax,xscale,xbase;	/* print title */	fprintf(fp,"\n");	fprintf(fp,"%s\n",title);	/* minimum and maximum x */	xmin = x[0];	xmax = x[0];	for (ix=1; ix<lx; ix++) {		xmin = MIN(xmin,x[ix]);		xmax = MAX(xmax,x[ix]);	}	fprintf(fp,"minimum = %g\n",xmin);	fprintf(fp,"maximum = %g\n",xmax);	/* determine scale factors and shifts for converting x values to *s */	if (xmin==xmax)		xscale = 1.0;	else		xscale = (ILC-IFC)/(xmax-xmin);	if (xmin<0.0 && xmax<0.0) {		ibase = ILC;		xbase = xmax;	} else if (xmin<0.0 && xmax>=0.0) {		ibase = IFC+(0.0-xmin)*xscale;		xbase = 0.0;	} else {		ibase = IFC;		xbase = xmin;	}	/* loop over x values */	for (ix=0; ix<lx; ix++) {		/* determine column corresponding to x value */		icx = ibase+NINT((x[ix]-xbase)*xscale);		icx = MAX(IFC,MIN(ILC,icx));		/* print the index, x value, and row of *s */		fprintf(fp,"%4d %13.6e ",ifx+ix,x[ix]);		for (ic=IFC; ic<MIN(ibase,icx); ic++)			fprintf(fp," ");		for (ic=MIN(ibase,icx); ic<=MAX(ibase,icx); ic++)			fprintf(fp,"*");		fprintf(fp,"\n");	}}

⌨️ 快捷键说明

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