RTXI  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
stepresp.cpp
Go to the documentation of this file.
1 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 //
3 // File = stepresp.cpp
4 //
5 //
6 
7 #include <math.h>
8 #include <stdlib.h>
9 #include <iostream>
10 
11 #include "complex.h"
12 #include "stepresp.h"
13 
14 using namespace std;
15 
16 #ifdef _DEBUG
17 extern std::ofstream DebugFile;
18 #endif
19 
20 //===========================================================
21 // constructors
22 
23 StepResponse::StepResponse(FilterTransFunc* trans_func, int num_resp_pts,
24  double delta_time)
25 {
26  Delta_Time = delta_time;
27  Num_Resp_Pts = num_resp_pts;
28  Imp_Resp = new ImpulseResponse(trans_func, num_resp_pts, delta_time);
29 
30  return;
31 };
32 
33 //=========================================================
34 void
36 {
37  int resp_indx;
38  double h_of_t, time, delta_t;
39  // double u_of_t; //Why is this uninitialized? -Ansel
40  double u_of_t = 0;
41 
42  Response_File = new ofstream("stp_anal.txt", ios::out);
43 
44  //-----------------------------------------------
45  // compute samples of impulse response
46 
47  delta_t = Delta_Time;
48 
49  for (resp_indx = 0; resp_indx < Num_Resp_Pts; resp_indx++) {
50  time = delta_t * resp_indx;
51  h_of_t = Imp_Resp->ComputeSample(time);
52  u_of_t += (delta_t * h_of_t);
53  (*Response_File) << time << ", " << u_of_t << std::endl;
54  }
55  Response_File->close();
56  return;
57 }
StepResponse(FilterTransFunc *trans_func, int num_resp_pts, double delta_t)
Definition: stepresp.cpp:23
std::ofstream DebugFile
void GenerateResponse(void)
Definition: stepresp.cpp:35