The following experiment takes an arbitrary GoldSequence and correlates that sequence with every other GoldSequence of GPS. There seems to be something special with sequence #37. It shows 2 peaks!
The java-program (with very little comments):
public void fillArray16() {
// correlation experiments
// construct a test-input with 1200 samples of Gold26 + noise
// find the match-point with all other possible sequences
// display peak in 3d
int shift = 0; // display only most interesting part
int inplen = 2500;
double[] testinput = new double[inplen];
double[] bins = new double[inplen];
int prns = 37; // # PRN sequences
double[][] plotData3d = new double[1268][prns];
Random r = new Random();
int noise = 3;
GoldSequence gold26;
gold26 = new GoldSequence(37); // find correlation with prn37
for (int i = 0; i < testinput.length; i++) {
testinput[i] = gold26.nextan() + noise * r.nextGaussian();
}
//implementation of a correlator
for (int prn = 1; prn <= prns; prn++) {
GoldSequence ref = new GoldSequence(prn);
for (int i = 0; i < 1268; i++) {
double acc = 0;
for (int j = 0; j < 1023; j++) {
if ((i + j) < inplen) {
acc = acc + testinput[i + j] * ref.nextan();
}
}
bins[i] = acc;
}
for (int i = 0; i < 1268; i++) {
plotData3d[i][prn - 1] = (bins[i + shift]) / 10.0;
}
}
int id = 1;
ShowPlot3d myPlot = new ShowPlot3d(id, plotData3d, "correlator");
myPlot.showFigure();
}
|
The output shows 2 peaks:
I expect 2 peaks at the utmost (last) row. The test-pattern is #37, the very last PRN-sequence. However there are 2 more peaks. The explanation is in the numbers for the taps in GoldSequence: A snippet of the coding:
private int[][] magnum =
{ {2,6}, {3,7}, {4,8}, {5,9}, {1,9}, {2,10}, {1,8},
{2,9}, {3,10},{2,3}, {3,4}, {5,6}, {6,7}, {7,8},
{8,9}, {9,10},{1,4}, {2,5}, {3,6}, {4,7}, {5,8},
{6,9}, {1,3}, {4,6}, {5,7}, {6,8}, {7,9}, {8,10},
{1,6}, {2,7}, {3,8}, {4,9}, {5,10},{4,10}, {1,7},
{2,8}, {4,10}
};
|
There are two pairs {4,10}. I don't know yet if that is perhaps an error in the book "a software defined gps and galileo receiver". Note: I asked the author and the pointed me to the original doc. This is intended.