91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

FFT加窗插值C程序 快速傅立葉變換(FFT)在測量電力系統諧波時存在的頻譜泄漏問題會產生較大誤差,從而影響分析結果。加窗插值算法可以有效減小泄漏,改善諧波幅值、相位測量準確度。

資源截圖

代碼片段和文件信息

/*****************fft?programe*********************/
/*基二FFT算法*/
#include?“math.h“
#include?“stdio.h“
struct?compx?
{?double?real;
??double?imag;
}?compx?;

struct?compx?EE(struct?compx?b1struct?compx?b2)
{
struct?compx?b3;
b3.real=b1.real*b2.real-b1.imag*b2.imag;
b3.imag=b1.real*b2.imag+b1.imag*b2.real;
return(b3);
}
void?FFT(struct?compx?*xinint?N)
{
int?fmLHnmikjL;
double?p??ps?;
int?leBip;
float?pi;
struct?compx?vwt;
LH=N/2;
f=N;
for(m=1;(f=f/2)!=1;m++){;}
nm=N-2;????
j=N/2;
/*變址運算*/
for(i=1;i<=nm;i++)
{
if(ik=LH;
while(j>=k){j=j-k;k=k/2;}
j=j+k;
}
{
for(L=1;L<=m;L++)
{??
le=pow(2L);
B=le/2;?
pi=3.14159;
?for(j=0;j<=B-1;j++)
??{
???p=pow(2m-L)*j;
???ps=2*pi/N*p;
???w.real=cos(ps);
???w.imag=-sin(ps);
???for(i=j;i<=N-1;i=i+le)
?????{?
??????ip=i+B;
??????t=EE(xin[ip]w);
??????xin[ip].real=xin[i].real-t.real;
??????xin[ip].imag=xin[i].imag-t.imag;
??????xin[i].real=xin[i].real+t.real;
??????xin[i].imag=xin[i].imag+t.imag;
?????}
??}
}
}???
return?;
}?


/************************************************
加blackmanharris窗,生成短時信號,inputN為每幀需計算的點數
************************************************/
int?Do_blackmanharris_window(float?*inputA?int?inputN)
{
????int?i;
????float*?blackmanharris_window?;????????????????/*暫存空間*/
????float?temp?=?(float)(2?*?M_PI?/?(float)(inputN-1));
????blackmanharris_window?=?(float*)malloc(inputN*4);
????for?(i=0?;?i????for?(i=0?;?i????free(blackmanharris_window);
????return(1);
}


/************************************************
插值
************************************************/
int?saluve_r(int?a)
{
double?x=1.99;
double?r=0;
double?k=1.2;
if(a>2.5)
return?0;
while((a-r)>0.00001||(a-r)<-0.00001)
{
r=-(2*pow(x6)-12*pow(x5)-941*pow(x4)+3844*pow(x3)+35041*pow(x2)?-77802*x-390632)*(x+3)/((2*pow(x6)-971*pow(x4)+

評論

共有 條評論