hamming.cpp

来自「《无线通信系统仿真——c++使用模型》这本书的源代码」· C++ 代码 · 共 31 行

CPP
31 行
字号
//
//  File = hamming.cpp
//

#include <math.h>
#include "hamming.h"
#include "misdefs.h"

//========================================================

HammingWindow::HammingWindow( int length )
              :GenericWindow(length)
{
  GenerateWindow( length );
}
//========================================================
void HammingWindow::GenerateWindow( int length )
{
 for(int n=0; n<Half_Length; n++)
   {
    if(length%2) // odd length
      { 
      Half_Lag_Win[n] = 0.54 + 0.46 * cos( double(TWO_PI)*n/(length-1));}
    else
      { Half_Lag_Win[n] = 0.54 + 0.46 * cos( (2*n+1)*PI/(length-1));}
   }

 return;
} 

⌨️ 快捷键说明

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