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

📄 plotscale.c

📁 speech signal process tools
💻 C
字号:
/*--------------------------------------------------------------+| ENTROPIC PROCESSING, INC.					||								|| This material contains proprietary software of Entropic	|| Processing, Inc.  Any reproduction, distribution, or		|| publication without the the prior written permission of	|| Entropic Processing, Inc.  is strictly prohibited.  Any	|| public distribution of copies of this work authorized in	|| writing by Entropic Processing, Inc.  must bear the notice 	||								||          "Copyright 1986 Entropic Processing, Inc."           ||								|+---------------------------------------------------------------+|								|| plotscale -- find round numbers for plot boundaries.		||								|| Joseph T. Buck, Entropic Processing, Inc.			|+--------------------------------------------------------------*//*Plotscale works as follows.  First it attempts to find adivisor, as follows.  It computes log10 of the difference vmax -vmin, or mindif, whichever is greater.  int (log10) is theexponent.  Then it finds the divides through by 10^exp to findthe mantissa:  (1.0 <= mantissa < 10.0).  It finds the firstinteger larger than the mantissa.  If it is two or three, thedivisor is 0.5*10^exp.  Otherwise it is 10^exp.  The returned min and max are evenly divisible by this divisor;*p_vmin is the floor, and *p_vmax is the ceiling.  Let	nticks = (*p_vmax - *p_vmin) / divisorthen if nticks < 8, div is the tick spacing.  Otherwise, ifnticks is divisible by 3, 3*div is the spacing, otherwise 2*divis the spacing.  *p_ndp is the number of places after thedecimal point (0 if the tick spacing is an integer.  */#ifdef SCCS	static char *sccs_id = "@(#)plotscale.c	1.2 9/23/86 EPI";#endif#include <stdio.h>double pow (), log10 ();voidplotscale (vmin, vmax, mindif, p_vmin, p_vmax, p_vtick, p_ndp)double    vmin, vmax, mindif, *p_vmin, *p_vmax, *p_vtick;int     *p_ndp;{    double   diff = vmax - vmin, teno, div, adiff;    int     o, adj, nticks;    if (diff < 0.0) diff = mindif;    o = log10 (diff);    teno = pow (10.0, (double) o);    adj = diff / teno + 0.999;    adiff = adj * teno;    div = teno;    if (adj <= 3)	div = teno / 2;/* Now move vmin down so it is divisible by div. */    if (vmin >= 0.0)	vmin = ((int) (vmin / div)) * div;    else	vmin = -((int) (-vmin / div + 0.9999)) * div;/* Now move vmax up so it is divisible by div. */    if (vmax >= 0.0)	vmax = ((int) (vmax / div + 0.9999)) * div;    else	vmax = -((int) (-vmax / div)) * div;    *p_vmin = vmin;    *p_vmax = vmax;/* Figure out tick marks. */    adiff = vmax - vmin;    nticks = adiff / div;    if (nticks < 8)	*p_vtick = div;    else if (nticks % 3 == 0)	*p_vtick = div * 3;    else	*p_vtick = div * 2;    *p_ndp = 0;    if (*p_vtick < 1.0)	*p_ndp = 0.9999 - log10 (*p_vtick);    return;}

⌨️ 快捷键说明

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