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

📄 rect_pulse_theory.cpp

📁 《无线通信系统仿真——c++使用模型》这本书的源代码
💻 CPP
字号:
//
//  File = rect_pulse_theory.cpp
//

#include <stdlib.h>
#include <math.h>
#include "rect_pulse_theory.h"
#include "sinc.h"
#include <fstream>
#ifndef PI
  #define PI 3.1415926535897932
#endif
using namespace std;

void RectPulseAliasPower( double fold_freq_hz,
                          int samps_per_hz,
                          char* out_filename)
{
   double freq, val;
   ofstream *out_file;
   out_file = new ofstream(out_filename, ios::out);

   int num_pts = int(1 + fold_freq_hz * samps_per_hz);

   double cumul_val = 0.0;
   double denom = double(samps_per_hz)/2.0;

   for(int n=0; n<num_pts; n++)
   {
      freq = n / double(samps_per_hz);

      val = sinc_sqrd(freq);
      cumul_val += val;

      (*out_file) << freq << ", " << val << ", " << cumul_val/denom << endl;
   }
   out_file->close();
   delete out_file;
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

⌨️ 快捷键说明

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