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

📄 wmmayuwa.c

📁 用来产生均匀分布或高斯分布的伪随机数 (近似白噪声)
💻 C
字号:
/*---------------------------------------------------------------------
 main program WMAYUWA :to test subroutine MMAYUWA
 To compute the coefficients of the MA model.
 Need subroutine :MARYUWA,MCORRE1,MRELFFT,MPSPLOT
---------------------------------------------------------------------*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "msp.h"
#include "mcorre1.c"
#include "mrelfft.c"
#include "mpsplot.c"
#include "maryuwa.c"
#include "mmayuwa.c"
void main()
{
        FILE *fp;
        complex x[128],b[32],a[32],r[32];
        int ip,iq,n,i,k,ierror;
        int *ierr;
        float t,ep;
        float *p_ep;
        ierr=&ierror;
        p_ep=&ep;
        ip=25;iq=10;t=1.0;n=128;ep=0.;ierror=0;
        if((fp=fopen("test.dat","r"))==NULL)
           {printf("cannot open file\n");
            exit(0);
            }
        for(i=0;i<n;i++)
            fscanf(fp,"%f,%f\n",&x[i].real,&x[i].imag);
            fclose(fp);
        mmayuwa(x,n,a,ip,b,iq,r,p_ep,t,ierr);
        printf("   white noise variance=%f\n",ep);
        printf("            k        b[k]\n");
        for(k=0;k<=iq;k++)
             printf("%d,%f,%f\n",k,b[k].real,b[k].imag);
        printf("            k        a[k]\n");
        for(k=0;k<=ip;k++)
            printf("%d,%f,%f\n",k,a[k].real,a[k].imag);
            }

⌨️ 快捷键说明

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