unwrap.cpp

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

CPP
42
字号
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//  File = unwrap.cpp
//
//

#include <math.h>
//#include <stdlib.h>
//#include <fstream>
#include "unwrap.h"
//using namespace std;

//extern ofstream *DebugFile;

//========================================
//
void UnwrapPhase( int samp_num, double *phase)
{
  static double half_circle_offset;
  static double old_phase;

  if(samp_num==0){
    half_circle_offset = 0.0;
    old_phase = *phase;
    }
  else{
    *phase = *phase + half_circle_offset;
    if( fabs(old_phase - *phase) > double(90.0)){
      if(old_phase < *phase){
        *phase = *phase - 360.0;
        half_circle_offset -= 360.0;
        }
      else{
        *phase = *phase + 360.0;
        half_circle_offset += 360.0;
        }
      }
    old_phase = *phase;
    }
  return;
}

⌨️ 快捷键说明

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