亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fourier.c

?? linux平臺下類似著名的電路板作圖軟件 Spice的源代碼
?? C
字號:
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group**********//* * Code to do fourier transforms on data.  Note that we do interpolation * to get a uniform grid.  Note that if polydegree is 0 then no interpolation * is done. */#include "spice.h"#include "cpdefs.h"#include "ftedefs.h"#include "ftedata.h"#include "fteparse.h"#include "sperror.h"#include "const.h"#include "util.h"#include "suffix.h"static char *pn();static int CKTfour();#define DEF_FOURGRIDSIZE 200/* CKTfour(ndata,numFreq,thd,Time,Value,FundFreq,Freq,Mag,Phase,nMag,nPhase) *         len   10      ?   inp  inp   inp      out  out out   out  out */voidcom_fourier(wl)    wordlist *wl;{    struct dvec *time, *vec;    struct pnode *names, *first_name;    double *ff, fundfreq, *dp, *stuff;    int nfreqs, fourgridsize, polydegree;    double *freq, *mag, *phase, *nmag, *nphase;  /* Outputs from CKTfour */    double thd, *timescale, *grid, d;    char *s;    int i, err, fw;    char xbuf[20];    int shift;    sprintf(xbuf, "%1.1e", 0.0);    shift = strlen(xbuf) - 7;    if (!plot_cur || !plot_cur->pl_scale) {        fprintf(cp_err, "Error: no vectors loaded.\n");        return;    }    if ((!cp_getvar("nfreqs", VT_NUM, (char *) &nfreqs)) || (nfreqs < 1))        nfreqs = 10;    if ((!cp_getvar("polydegree", VT_NUM, (char *) &polydegree)) ||            (polydegree < 0))        polydegree = 1;    if ((!cp_getvar("fourgridsize", VT_NUM, (char *) &fourgridsize)) ||            (fourgridsize < 1))        fourgridsize = DEF_FOURGRIDSIZE;    time = plot_cur->pl_scale;    if (!isreal(time)) {        fprintf(cp_err, "Error: fourier needs real time scale\n");        return;    }    s = wl->wl_word;    if (!(ff = ft_numparse(&s, false)) || (*ff <= 0.0)) {        fprintf(cp_err, "Error: bad fund freq %s\n", wl->wl_word);        return;    }    fundfreq = *ff;    freq = (double *) tmalloc(nfreqs * sizeof (double));    mag = (double *) tmalloc(nfreqs * sizeof (double));    phase = (double *) tmalloc(nfreqs * sizeof (double));    nmag = (double *) tmalloc(nfreqs * sizeof (double));    nphase = (double *) tmalloc(nfreqs * sizeof (double));    wl = wl->wl_next;    names = ft_getpnames(wl, true);    first_name = names;    while (names) {        vec = ft_evaluate(names);        names = names->pn_next;        while (vec) {            if (vec->v_length != time->v_length) {                fprintf(cp_err,                     "Error: lengths don't match: %d, %d\n",                        vec->v_length, time->v_length);                continue;            }            if (!isreal(vec)) {                fprintf(cp_err, "Error: %s isn't real!\n",                         vec->v_name);                continue;            }            if (polydegree) {                /* Build the grid... */                grid = (double *) tmalloc(fourgridsize *                        sizeof (double));                stuff = (double *) tmalloc(fourgridsize *                        sizeof (double));                dp = ft_minmax(time, true);                /* Now get the last fund freq... */                d = 1 / fundfreq;   /* The wavelength... */                if (dp[1] - dp[0] < d) {                    fprintf(cp_err,                 "Error: wavelength longer than time span\n");                    return;                } else if (dp[1] - dp[0] > d) {                    dp[0] = dp[1] - d;                }                d = (dp[1] - dp[0]) / fourgridsize;                for (i = 0; i < fourgridsize; i++)                    grid[i] = dp[0] + i * d;                                /* Now interpolate the stuff... */                if (!ft_interpolate(vec->v_realdata, stuff,                        time->v_realdata, vec->v_length,                        grid, fourgridsize,                         polydegree)) {                    fprintf(cp_err,                         "Error: can't interpolate\n");                    return;                }                timescale = grid;            } else {                fourgridsize = vec->v_length;                stuff = vec->v_realdata;                timescale = time->v_realdata;            }            err = CKTfour(fourgridsize, nfreqs, &thd, timescale,                    stuff, fundfreq, freq, mag, phase, nmag,                    nphase);            if (err != OK) {                ft_sperror(err, "fourier");                return;            }            fprintf(cp_out, "Fourier analysis for %s:\n",                     vec->v_name);            fprintf(cp_out, "  No. Harmonics: %d, THD: %g %%, Gridsize: %d, Interpolation Degree: %d\n\n",                nfreqs,  thd, fourgridsize,                 polydegree);            /* Each field will have width cp_numdgt + 6 (or 7             * with HP-UX) + 1 if there is a - sign.             */            fw = ((cp_numdgt > 0) ? cp_numdgt : 6) + 5 + shift;            fprintf(cp_out, "Harmonic %-*s %-*s %-*s %-*s %-*s\n",                    fw, "Frequency", fw, "Magnitude",                     fw, "Phase", fw, "Norm. Mag",                    fw, "Norm. Phase");            fprintf(cp_out, "-------- %-*s %-*s %-*s %-*s %-*s\n",                    fw, "---------", fw, "---------",                    fw, "-----", fw, "---------",                    fw, "-----------");            for (i = 0; i < nfreqs; i++)                fprintf(cp_out,                    " %-4d    %-*s %-*s %-*s %-*s %-*s\n",                    i,                    fw, pn(freq[i]),                    fw, pn(mag[i]),                    fw, pn(phase[i]),                    fw, pn(nmag[i]),                    fw, pn(nphase[i]));            fputs("\n", cp_out);            vec = vec->v_link2;        }    }    free_pnode(first_name);    tfree(freq);    tfree(mag);    tfree(phase);    tfree(nmag);    tfree(nphase);    return;}static char *pn(num)    double num;{    char buf[BSIZE_SP];    int i = cp_numdgt;    if (i < 1)        i = 6;    if (num < 0.0)        (void) sprintf(buf, "%.*lg", i - 1, num);    else        (void) sprintf(buf, "%.*lg", i, num);    return (copy(buf));}/* * CKTfour() - perform fourier analysis of an output vector. *  Due to the construction of the program which places all the *  output data in the post-processor, the fourier analysis can not *  be done directly.  This function allows the post processor to *  hand back vectors of time and data values to have the fourier analysis *  performed on them. * *//*ARGSUSED*/static intCKTfour(ndata,numFreq,thd,Time,Value,FundFreq,Freq,Mag,Phase,nMag,nPhase)    int ndata;  /* number of entries in the Time and Value arrays */    int numFreq;    /* number of harmonics to calculate */    double *thd;    /* total harmonic distortion (percent) to be returned */    double *Time;   /* times at which the voltage/current values were measured*/    double *Value;  /* voltage or current vector whose transform is desired */    double FundFreq;    /* the fundamental frequency of the analysis */    double *Freq;   /* the frequency value of the various harmonics */    double *Mag;    /* the Magnitude of the fourier transform */    double *Phase;  /* the Phase of the fourier transform */    double *nMag;   /* the normalized magnitude of the transform: nMag(fund)=1*/    double *nPhase; /* the normalized phase of the transform: Nphase(fund)=0 */    /* note we can consider these as a set of arrays:  The sizes are:     *  Time[ndata], Value[ndata]     *  Freq[numFreq],Mag[numfreq],Phase[numfreq],nMag[numfreq],nPhase[numfreq]     * The arrays must all be allocated by the caller.     * The Time and Value array must be reasonably distributed over at     * least one full period of the fundamental Frequency for the     * fourier transform to be useful.  The function will take the     * last period of the frequency as data for the transform.     */{/* we are assuming that the caller has provided exactly one period * of the fundamental frequency. */    int i;    int j;    double tmp;    /* clear output/computation arrays */    for(i=0;i<numFreq;i++) {        Mag[i]=0;        Phase[i]=0;    }    for(i=0;i<ndata;i++) {        for(j=0;j<numFreq;j++) {            Mag[j]   += (Value[i]*sin(j*2.0*M_PI*i/((double) ndata)));            Phase[j] += (Value[i]*cos(j*2.0*M_PI*i/((double) ndata)));        }    }    Mag[0] = Phase[0]/ndata;    Phase[0]=nMag[0]=nPhase[0]=Freq[0]=0;    *thd = 0;    for(i=1;i<numFreq;i++) {        tmp = Mag[i]*2.0 /ndata;        Phase[i] *= 2.0/ndata;        Freq[i] = i * FundFreq;        Mag[i] = sqrt(tmp*tmp+Phase[i]*Phase[i]);        Phase[i] = atan2(Phase[i],tmp)*180.0/M_PI;        nMag[i] = Mag[i]/Mag[1];        nPhase[i] = Phase[i]-Phase[1];        if(i>1) *thd += nMag[i]*nMag[i];    }    *thd = 100*sqrt(*thd);    return(OK);}#ifdef notdef    /* What is this code?  An old DFT? */    double initial; /*  starting time */    double final;   /* final time */    double elapsed; /* elapsed time */    double tmp;    int start=0;    int n;    int m;    int edge;    *thd = 0;    final = Time[ndata-1];    initial = Time[0];    elapsed = final - initial;    if( (elapsed-1/FundFreq)< -.01/FundFreq ){        /* not enough data for a full period */        return(E_BADPARM);    }    elapsed = 1/FundFreq;   /* set to desired elapsed time */    initial = final - elapsed;  /* set to desired starting time */    while(Time[start]<initial) { start++; } /* to find first time in interval*/    start++; /* throw away one more point - come back to it later */    for(m=0;m<numFreq;m++) {        Mag[m]=0;        Phase[m]=0;    }    /* ok - here's the hard part - compute the dft of Data[start::ndata]     * temporarily, put the real/imag. parts of the DFT in Mag[] and Phase[]     * later we will convert each term to phase-magnitude      */    for(n=start;n<ndata-1;n++) {        for(m=0;m<numFreq;m++) {            Mag[m]   += .5 * (Time[n+1]-Time[n-1]) * Value[n] *                     sin(2.0*M_PI*m*((Time[n]-initial)/elapsed));            Phase[m] += .5 * (Time[n+1]-Time[n-1]) * Value[n] *                     cos(2.0*M_PI*m*((Time[n]-initial)/elapsed));            /* know Time[n+-1] exists because stop at = ndata-2, */            /* and did a start++ earlier - come back and clean up ends later */        }    }    /* now to deal with the endpoints.  The (ndata-1)th point has a smaller      * interval      */    for(m=0;m<numFreq;m++) {        Mag[m]   += 0.5 * (Time[n]-Time[n-1]) * Value[n] *                 sin(2.0*M_PI*m*((Time[n]-initial)/elapsed));        Phase[m] += 0.5 * (Time[n]-Time[n-1]) * Value[n] *                 cos(2.0*M_PI*m*((Time[n]-initial)/elapsed));    }    /* now to deal with the start of the interval.  first, deal with     * the start-1'th point - exactly the same regardless of case      * because of the extra start++ earlier.     */    for(m=0;m<numFreq;m++) {        Mag[m]   += 0.5 * (Time[start]-initial) * Value[start-1] *                 sin(2.0*M_PI*m*((Time[start-1]-initial)/elapsed));        Phase[m] += 0.5 * (Time[start]-initial) * Value[start-1] *                 cos(2.0*M_PI*m*((Time[start-1]-initial)/elapsed));    }    /* now deal with the possibility that the above point, which was     * the first one contained within the interval may have been     * inside the interval, or ON the boundry - in the latter case,     * we don't want to deal with the previous point at all.     */    if(Time[start-1]> initial) {        /* interesting case - need to handle previous point */        /* first, make sure that there is a point on the other side of         * the beginning of time.         */        if(start-2 < 0) {             /* point doesn't exist, so we have to fudge             * things slightly - by bumping edge up, we re-use the first             * point in the interval for the last point before the              * interval - should be only for very small error in             * interval boundaries, so shouldn't be significant, and is             * better than ignoring the interval             */            edge = start-1;        } else {            edge = start-2;        }        for(m=0;m<numFreq;m++) {            Mag[m]   += .5 * (Time[start-1]-initial) * Value[edge] *                     sin(2.0*M_PI*m*((Time[edge]-initial)/elapsed));            Phase[m] += .5 * (Time[start-1]-initial) * Value[edge] *                     cos(2.0*M_PI*m*((Time[edge]-initial)/elapsed));        }    }        Mag[0]=Phase[0]/elapsed;    Phase[0]=nMag[0]=nPhase[0]=Freq[0]=0;    for(m=1;m<numFreq;m++) {        tmp = Mag[m] * 2.0 / (elapsed);        Phase[m] *= 2.0 / (elapsed);        Freq[m] = m * FundFreq;        Mag[m] = sqrt(tmp * tmp + Phase[m] * Phase[m]);        Phase[m] = atan2(Phase[m],tmp) * 180.0/M_PI;        nMag[m] = Mag[m] / Mag[1];        nPhase[m] = Phase[m] - Phase[1];        if(m>1) *thd += nMag[m] * nMag[m];    }    *thd = 100 * sqrt(*thd);    return(OK);#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩中文字幕1| 亚洲视频电影在线| 5858s免费视频成人| 欧美色精品在线视频| 色呦呦日韩精品| 欧美性猛片xxxx免费看久爱| 欧美日韩一区三区四区| 91精品国产综合久久精品麻豆| 欧美日韩在线观看一区二区| 在线成人av网站| 精品国产三级电影在线观看| 2024国产精品| 亚洲精选视频在线| 亚洲一区二区欧美日韩| 日本一不卡视频| 国产激情视频一区二区三区欧美| 成人午夜视频在线观看| 一本大道av一区二区在线播放| 欧美日韩在线播放一区| 精品1区2区在线观看| 国产精品久久久久久久岛一牛影视| 国产精品高潮呻吟| 性感美女极品91精品| 国产一区二区在线影院| 成+人+亚洲+综合天堂| 欧美日韩一区二区欧美激情| 精品国产人成亚洲区| 亚洲欧洲三级电影| 人人狠狠综合久久亚洲| 风流少妇一区二区| 7777精品伊人久久久大香线蕉超级流畅 | 亚洲电影一区二区三区| 午夜久久久久久| 丁香激情综合国产| 欧美三级电影在线看| 久久久亚洲午夜电影| 亚洲一区二区三区影院| 国产一区999| 欧美日韩精品一区二区在线播放| 久久久久88色偷偷免费| 亚洲观看高清完整版在线观看| 国产福利精品一区二区| 欧美女孩性生活视频| 中文字幕亚洲一区二区va在线| 奇米777欧美一区二区| 97精品国产露脸对白| 久久综合色8888| 日韩精品一级中文字幕精品视频免费观看 | 久久久精品蜜桃| 日韩激情中文字幕| 色婷婷香蕉在线一区二区| 久久亚洲一区二区三区明星换脸| 亚洲一区二区综合| 9色porny自拍视频一区二区| 欧美videos中文字幕| 五月激情丁香一区二区三区| 不卡的av网站| 国产视频一区二区三区在线观看| 蜜臀久久99精品久久久久久9| 色噜噜偷拍精品综合在线| 中文字幕精品一区| 国产黑丝在线一区二区三区| 日韩免费电影网站| 午夜电影一区二区三区| 欧美色精品天天在线观看视频| 18成人在线视频| 99国产精品国产精品毛片| 欧美韩日一区二区三区| 国产精品资源在线看| 精品人伦一区二区色婷婷| 奇米色777欧美一区二区| 欧美日本一区二区在线观看| 亚洲制服丝袜一区| 欧美日韩精品一区二区在线播放| 亚洲第四色夜色| 欧美系列亚洲系列| 亚洲成人黄色影院| 91精品国产综合久久久久久久 | 成人美女视频在线观看| 国产精品女上位| 99国产精品国产精品毛片| 亚洲免费在线看| 在线区一区二视频| 午夜精品在线看| 日韩欧美一区二区久久婷婷| 美女脱光内衣内裤视频久久网站 | 91精品国产综合久久香蕉的特点| 日韩高清一区二区| 欧美成人猛片aaaaaaa| 国产激情一区二区三区四区| 国产精品久久久久影院亚瑟| 色综合久久中文字幕综合网| 亚洲国产aⅴ成人精品无吗| 91精品国产欧美一区二区成人| 美女精品自拍一二三四| 精品国产乱子伦一区| 成人在线视频首页| 一区二区三区成人在线视频| 欧美日本高清视频在线观看| 九九热在线视频观看这里只有精品| 久久久久久久综合| av亚洲精华国产精华精| 丝袜诱惑制服诱惑色一区在线观看| 日韩午夜在线影院| 懂色av中文一区二区三区| 一区二区三区蜜桃| 欧美白人最猛性xxxxx69交| www.欧美色图| 日本不卡一区二区三区| 国产精品日韩成人| 91精品国产高清一区二区三区蜜臀| 国产精品一区不卡| 午夜电影网亚洲视频| 欧美高清在线精品一区| 欧美美女一区二区| 成人高清在线视频| 精品制服美女久久| 亚洲国产精品精华液网站| 久久久www成人免费无遮挡大片| 欧美丝袜丝nylons| 国产 欧美在线| 精品一区二区三区久久| 午夜久久电影网| 亚洲人成电影网站色mp4| 久久理论电影网| 91精品国产免费久久综合| 色噜噜狠狠色综合欧洲selulu| 国产99久久久精品| 精品综合久久久久久8888| 日韩精品91亚洲二区在线观看 | 欧美日韩另类一区| 91蝌蚪porny| 成人网在线免费视频| 国产美女视频一区| 久久精品国产99久久6| 日韩电影在线免费观看| 一区二区高清视频在线观看| 国产精品麻豆久久久| 久久精品亚洲一区二区三区浴池| 日韩精品专区在线| 欧美久久一二区| 欧美午夜精品免费| 欧美图片一区二区三区| 91福利国产成人精品照片| 色婷婷激情综合| 色av一区二区| 欧美亚洲日本一区| 欧美日韩在线综合| 欧美顶级少妇做爰| 欧美一区二区三区的| 4438成人网| 亚洲精品在线观看网站| 日韩三级免费观看| 欧美成人欧美edvon| 久久久国产精华| 国产精品色眯眯| 亚洲欧美日韩国产综合| 亚洲激情校园春色| 亚洲v精品v日韩v欧美v专区| 日本视频中文字幕一区二区三区| 欧美aaa在线| 国产成人免费9x9x人网站视频| 成人免费毛片片v| 97se亚洲国产综合自在线观| 欧洲另类一二三四区| 欧美精品xxxxbbbb| 欧美va亚洲va在线观看蝴蝶网| 久久一日本道色综合| 国产精品女主播在线观看| 亚洲另类在线制服丝袜| 午夜国产精品一区| 韩国午夜理伦三级不卡影院| 成人免费毛片嘿嘿连载视频| 色综合久久天天综合网| 91精品国产综合久久香蕉麻豆| 亚洲精品一区二区三区福利| 国产精品久久久久婷婷| 一区二区欧美国产| 奇米四色…亚洲| 99国产欧美另类久久久精品| 欧美日韩成人综合天天影院| 久久免费国产精品| 亚洲成a天堂v人片| 国产精品亚洲а∨天堂免在线| 91性感美女视频| 日韩欧美你懂的| 亚洲日本va午夜在线影院| 日韩精品91亚洲二区在线观看| 懂色av一区二区在线播放| 欧美人妖巨大在线| 欧美激情一区二区| 美女任你摸久久| 色菇凉天天综合网| 久久久久免费观看| 石原莉奈一区二区三区在线观看 | 中文字幕 久热精品 视频在线 | 国产精品一二三区| 91精品在线一区二区| 亚洲欧美日本韩国| 岛国一区二区三区|