RTXI  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sam_spec.cpp
Go to the documentation of this file.
1 //
2 // file = sam_spec.cpp
3 //
4 
5 #include "sam_spec.h"
6 #include "complex.h"
7 #include "fft.h"
8 #include <iostream>
9 #include <stdlib.h>
10 
11 SampleSpectrum::SampleSpectrum(complex* time_signal, double samp_intvl,
12  int num_samps)
13  : PsdEstimate(num_samps, samp_intvl)
14 {
15  complex* sample_spectrum = new complex[num_samps];
16 
17  fft(time_signal, sample_spectrum, num_samps);
18  for (int samp_idx = 0; samp_idx < num_samps; samp_idx++) {
19  Psd_Est[samp_idx] = mag_sqrd(sample_spectrum[samp_idx]);
20  }
21  return;
22 }
void fft(complex *time_signal, complex *sample_spectrum, int num_samps)
Definition: fft.cpp:24
SampleSpectrum(complex *big_x, double samp_intvl, int big_n)
Definition: sam_spec.cpp:11
double mag_sqrd(const complex _z)
Definition: complex.h:128
double * Psd_Est
Definition: psd_est.h:25