diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2016-02-14 08:27:10 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2016-02-14 08:27:10 -0800 |
commit | 4aabba72f0d268174855fce97a80bd55acb1358c (patch) | |
tree | d9ce58ce4b10213e4194aa7777f0c825ba5304a4 | |
parent | 46f3ee7c5e5a67405f91c45ba8fe63989fbcbfdb (diff) | |
parent | 9753ff4d521b74328bdccc2783e8a8e5ac31362e (diff) |
Merge remote-tracking branch 'bastibl/rayleigh_fading' into next
-rw-r--r-- | gr-channels/lib/fading_model_impl.cc | 11 | ||||
-rw-r--r-- | gr-channels/lib/flat_fader_impl.cc | 18 |
2 files changed, 9 insertions, 20 deletions
diff --git a/gr-channels/lib/fading_model_impl.cc b/gr-channels/lib/fading_model_impl.cc index 7eb9d0612c..721a43f8f6 100644 --- a/gr-channels/lib/fading_model_impl.cc +++ b/gr-channels/lib/fading_model_impl.cc @@ -22,17 +22,6 @@ #include "fading_model_impl.h" #include <gnuradio/io_signature.h> -#include <iostream> - -#include <boost/format.hpp> -#include <boost/random.hpp> - -#include <gnuradio/fxpt.h> -#include <sincostable.h> - - -// FASTSINCOS: 0 = slow native, 1 = gr::fxpt impl, 2 = sincostable.h -#define FASTSINCOS 2 namespace gr { diff --git a/gr-channels/lib/flat_fader_impl.cc b/gr-channels/lib/flat_fader_impl.cc index 0b4cab2337..729e5d52ae 100644 --- a/gr-channels/lib/flat_fader_impl.cc +++ b/gr-channels/lib/flat_fader_impl.cc @@ -48,7 +48,7 @@ namespace gr { d_table(8*1024), - scale_sin(sqrtf(2.0/d_N)), + scale_sin(sqrtf(1.0/d_N)), scale_los(sqrtf(d_K)/sqrtf(d_K+1)), scale_nlos(1/sqrtf(d_K+1)) { @@ -63,18 +63,18 @@ namespace gr { gr_complex flat_fader_impl::next_sample(){ gr_complex H(0,0); - for(int n=1; n<d_N; n++){ - float alpha_n = (2*M_PI*n - M_PI + d_theta)/(4*d_N); + for(int n=1; n<=d_N; n++){ + float alpha_n = (2*M_PI*n - M_PI + d_theta)/(4*d_N); #if FASTSINCOS == 1 - float s_i = scale_sin*gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::cos(gr::fxpt::float_to_fixed(alpha_n))+d_psi[n+1])); - float s_q = scale_sin*gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::sin(gr::fxpt::float_to_fixed(alpha_n))+d_phi[n+1])); + float s_i = scale_sin*gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::cos(gr::fxpt::float_to_fixed(alpha_n))+d_psi[n])); + float s_q = scale_sin*gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::sin(gr::fxpt::float_to_fixed(alpha_n))+d_phi[n])); #elif FASTSINCOS == 2 - float s_i = scale_sin*d_table.cos(2*M_PI*d_fDTs*d_m*d_table.cos(alpha_n)+d_psi[n+1]); - float s_q = scale_sin*d_table.cos(2*M_PI*d_fDTs*d_m*d_table.sin(alpha_n)+d_phi[n+1]); + float s_i = scale_sin*d_table.cos(2*M_PI*d_fDTs*d_m*d_table.cos(alpha_n)+d_psi[n]); + float s_q = scale_sin*d_table.cos(2*M_PI*d_fDTs*d_m*d_table.sin(alpha_n)+d_phi[n]); #else - float s_i = scale_sin*cos(2*M_PI*d_fDTs*d_m*cos(alpha_n)+d_psi[n+1]); - float s_q = scale_sin*cos(2*M_PI*d_fDTs*d_m*sin(alpha_n)+d_phi[n+1]); + float s_i = scale_sin*cos(2*M_PI*d_fDTs*d_m*cos(alpha_n)+d_psi[n]); + float s_q = scale_sin*cos(2*M_PI*d_fDTs*d_m*sin(alpha_n)+d_phi[n]); #endif H += gr_complex(s_i, s_q); |