ninteg.c

来自「ngspice又一个电子CAD仿真软件代码.功能更全」· C语言 代码 · 共 45 行

C
45
字号
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1987 Gary W. Ng**********//* * Nintegrate.c (noizDens, lnNdens, lnNlstDens, data) * *    This subroutine evaluates the integral of the function * *                                             EXPONENT *                      NOISE = a * (FREQUENCY) * *   given two points from the curve.  If EXPONENT is relatively close *   to 0, the noise is simply multiplied by the change in frequency. *   If it isn't, a more complicated expression must be used.  Note that *   EXPONENT = -1 gives a different equation than EXPONENT <> -1. *   Hence, the reason for the constant 'N_INTUSELOG'. */#include "ngspice.h"#include "noisedef.h"doubleNintegrate (double noizDens, double lnNdens, double lnNlstDens, Ndata *data){    double exponent;    double a;    exponent = (lnNdens - lnNlstDens) / data->delLnFreq;    if ( fabs(exponent) < N_INTFTHRESH ) {	return (noizDens * data->delFreq);    } else {	a = exp(lnNdens - exponent*data->lnFreq);	exponent += 1.0;	if (fabs(exponent) < N_INTUSELOG) {	    return (a * (data->lnFreq - data->lnLastFreq));        } else {	    return (a * ((exp(exponent * data->lnFreq) - exp(exponent * data->lnLastFreq)) /		    exponent));        }    }}

⌨️ 快捷键说明

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