Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 2.45 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. gcc to VC   2010 got LNK 2019 error
  2. using SPUC::baud_eq_env;
  3. using SPUC::noise;
  4. baud_eq_env ddfse_env(paths);
  5. noise random_offset;
  6.        
  7. #include <iostream>
  8. #include <fstream>
  9. #include <iomanip>
  10. using namespace std;
  11. #include "baud_eq_env.h"
  12. #include <spuc.h>
  13. #include "noise.h"
  14. using namespace SPUC;
  15. void baud_eq_env::loop_init(long equalizer_type, long data_delay,
  16.                             double delay_spread)
  17. {
  18.     long mlse_len;
  19.     output_delay = data_delay;
  20.     eq_type = equalizer_type;
  21.     var = sqrt(2.0)*pow(10.0,-0.05*snr);   // Unfiltered noise std dev  
  22.     BER_mon = new bpsk_ber_test;
  23.     tx_data_source = new max_pn;
  24.     multipaths = new fading_channel(paths,delay_spread);
  25.     mlse_len = paths-1;
  26.  
  27.     // PICK EQUALIZER Type
  28.     DUT = new mle<complex<double> >((char)(mlse_len));
  29.     multipaths->exp_decay.coeff[0] = 0.9;
  30.     multipaths->exp_decay.coeff[1] = 0.1;
  31.  
  32. #ifndef NEWNOISE
  33.     n = new SPUC::noise;
  34. #endif  
  35.     // initialise CIR from Channel CIR
  36.     DUT->set_cir(multipaths->exp_decay);
  37.     rcv_symbols=0;            // Number of symbols decoded
  38.     count=0;                 // index of sample number at input rate
  39.     phase_acc=0;
  40. }
  41.        
  42. #ifndef NOISE
  43. #define NOISE
  44.  
  45. namespace SPUC {
  46.  
  47. #include "complex.h"
  48.  
  49. #define M 714025
  50. #define IA 1366
  51. #define IC 150889
  52. #define LM 2147483647
  53. #define LAM (1.0/LM)
  54. #define LA 16807
  55. #define LR 2836
  56. #define LQ 127773
  57.     /*!
  58.     addtogroup miscfunc  Miscellaneous DSP classes
  59.     */
  60.  
  61.     /*!   brief Gaussian noise routine
  62.     ingroup miscfunc random
  63.     */
  64.     //!   Gaussian noise routine
  65.     //!   Can create (double) gaussian white noise
  66.     //!              complex<double> gaussian white noise
  67.     //!          or  (double) uniform noise
  68.     //!  Requires complex  class
  69.     class noise
  70.     {  
  71.     protected:
  72.         char s;            //! Switch
  73.         double x;          //! Saved calculated value
  74.         long idum;         //! Random seed
  75.  
  76.     public:                            
  77.         //! Constructor
  78.         noise(double i=1349555.0);                      // Constructor
  79.         //! Gaussian noise
  80.         double gauss();
  81.         //! complex gaussian noise
  82.         complex<double> Cgauss(void);
  83.         //! Uniform noise
  84.         double uni();            
  85.         //! Uniform noise
  86.         double uniform();
  87.         //!  Change seed
  88.         void set_seed(double i=1349555.0) { idum = (long)i;}
  89.         //!  Change seed
  90.         void set_seed(unsigned i=1349555) { idum = i;}
  91.     } ;
  92.     //#endif
  93. } // namespace SPUC
  94.  
  95. #endif