From 8d3f23788cf5cfe828e9ee77f05d951465ce1c3f Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Sun, 21 Jun 2015 22:32:22 +0000 Subject: [PATCH] Replace some hardwired parameters with variables in wsprd_exp. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5625 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/wsprd/wsprd_exp.c | 53 +++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/lib/wsprd/wsprd_exp.c b/lib/wsprd/wsprd_exp.c index 77d796dcc..9bbe58217 100644 --- a/lib/wsprd/wsprd_exp.c +++ b/lib/wsprd/wsprd_exp.c @@ -389,8 +389,8 @@ void subtract_signal2(double *id, double *qd, long np, float f0, int shift0, float drift0, unsigned char* channel_symbols) { double dt=1.0/375.0, df=375.0/256.0; - int i, j, k, ii, nfilt=256; //nfilt must be even number. - double pi=4.*atan(1.0),twopidt; + double pi=4.*atan(1.0), twopidt, phi=0, dphi, cs; + int i, j, k, ii, nsym=162, nspersym=256, nfilt=256; //nfilt must be even number. double refi[45000],refq[45000]; double ci[45000],cq[45000],cfi[45000],cfq[45000]; @@ -401,26 +401,30 @@ void subtract_signal2(double *id, double *qd, long np, memset(cfi,0,sizeof(double)*45000); memset(cfq,0,sizeof(double)*45000); - double phi=0, dphi; - // double dphi, cdphi, sdphi; - twopidt=2.0*pi*dt; - // measured signal is: s(t)=a(t)*exp( j*theta(t) ) - // reference is: r(t) = exp( j*phi(t) ) - // complex amplitude is estimated as: c(t)=LPF[s(t)*conjugate(r(t))] - // so c(t) has phase angle theta-phi - // multiply r(t) by c(t) and subtract from s(t), i.e. s'(t)=s(t)-c(t)r(t) +/****************************************************************************** + Measured signal: s(t)=a(t)*exp( j*theta(t) ) + Reference is: r(t) = exp( j*phi(t) ) + Complex amplitude is estimated as: c(t)=LPF[s(t)*conjugate(r(t))] + so c(t) has phase angle theta-phi + Multiply r(t) by c(t) and subtract from s(t), i.e. s'(t)=s(t)-c(t)r(t) +*******************************************************************************/ // create reference wspr signal vector, centered on f0. - for (i=0; i<162; i++) { + // + for (i=0; i0) & (k0) & (k