RTXI  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
con_hann.cpp
Go to the documentation of this file.
1 //
2 // File = hann.cpp
3 //
4 
5 #include <iostream>
6 #include <math.h>
7 #include "typedefs.h"
8 #include "con_hann.h"
9 #include "misdefs.h"
10 #include "sinc.h"
11 
12 using namespace std;
13 
14 ContHannMagResp::ContHannMagResp(istream& uin, ostream& uout)
15  : ContinWindowResponse(uin, uout)
16 {
17  double x, amp0, tau, freq, freq_exp, freq_cyc;
18 
19  tau = 1.0;
20  freq_cyc = 2.0;
21  amp0 = 0.5;
22 
23  for (int n = 0; n < Num_Resp_Pts; n++) {
24  freq_exp = 1.0 + freq_cyc * (n - Num_Resp_Pts) / ((double)Num_Resp_Pts);
25  freq = pow((double)10.0, freq_exp);
26  x = 0.5 * tau * sinc(PI * tau * freq);
27  x += (0.25 * tau * sinc(PI * tau * (freq - tau)));
28  x += (0.25 * tau * sinc(PI * tau * (freq + tau)));
29  if (Db_Scale_Enab)
30  x = 20.0 * log10(fabs(x / amp0));
31  (*Response_File) << freq << ", " << x << std::endl;
32  }
33 }
double sinc(double x)
Definition: sinc.cpp:10
logical Db_Scale_Enab
Definition: con_resp.h:20
#define PI
Definition: misdefs.h:9
ContHannMagResp(std::istream &uin, std::ostream &uout)
Definition: con_hann.cpp:14