Aug 8, 2018 04:36 PM
(This post was last modified: Aug 8, 2018 05:01 PM by Eccentric.)
So I have been doing some searching around and pretty much have found no help. I don't know if there is anyone on here that can help but it is worth a shot.
So basically my issue here is I want to create an app that will track cb radio frequencies to there exact location for and app that will tell you pretty much where every cop is on the road. The only way I know of that can track a radio frequency to it's exact location is by using a spectrum analyzer, I know the government uses these to track Pirate radio frequencies to protect ships against attacks. Now the question is their a way to code a spectrum analyzer in java? I know it would be hard and I am up for the task, I am just having a bit of trouble finding out where to start. If anyone has any information on this then please let me know!
So basically my issue here is I want to create an app that will track cb radio frequencies to there exact location for and app that will tell you pretty much where every cop is on the road. The only way I know of that can track a radio frequency to it's exact location is by using a spectrum analyzer, I know the government uses these to track Pirate radio frequencies to protect ships against attacks. Now the question is their a way to code a spectrum analyzer in java? I know it would be hard and I am up for the task, I am just having a bit of trouble finding out where to start. If anyone has any information on this then please let me know!
have no idea why it double posted either
Something like this. I know this isn't java but this is for an Arduino.
Code
int main(void)
{
int N=250;
double data[N];
double samples[N];
double freq;
double s;
double s_prev;
double s_prev2;
double coeff;
double magn;
int i;
int gd=CUSTOM, gm=CUSTOM_MODE(700,700);
initgraph(&gd, &gm, "");
setcolor(WHITE);
int X1,Y1,X2,Y2;
double scale,xmin,ymin,xmax,ymax;
// Find the maximum and minimum data range
xmin=0;
ymin=0;
xmax=50000;
ymax=N;
scale=1.1*(xmax-xmin>ymax-ymin?xmax-xmin:ymax-ymin);
// Generate samples
for (i=0;i<N;i++) {
samples[i]=(50*sin(2*M_PI*i*3300/SampleFreq)+50*sin(2*M_PI*i*5700/SampleFreq)+50*sin(2*M_PI*i*25700/SampleFreq)+100);
// Window the data
// data[i]=samples[i]; // Straight Goertzel - not great
// data[i]=samples[i]*(0.5-0.25*cos(2*M_PI*i/N)); // Hanning Window
data[i]=samples[i]*(0.54-0.46*cos(2*M_PI*i/N)); // Hamming Window
// data[i]=samples[i]*(0.426551-0.496561*cos(2*M_PI*i/N)+0.076848*cos(4*M_PI*i/N)); // Exact Blackman Window
}
// Scan frequencies
for (freq=100;freq<=50000;freq+=100) {
coeff=2*cos(2*M_PI*freq/SampleFreq);
s_prev=0.0;
s_prev2=0.0;
for (i=0;i<N;i++) {
// Goertzel
s=data[i]+coeff*s_prev-s_prev2;
s_prev2=s_prev;
s_prev=s;
}
// Get magnitude
magn=2*sqrt(s_prev2*s_prev2+s_prev*s_prev-coeff*s_prev*s_prev2)/N;
printf("Freq: %6f Mag: %6.4f\n",freq,magn);
// Plot data
X1=(int)((freq-(xmin+xmax)/2)*700/scale+350);
Y1=(int)((0+(ymin+ymax)/2)*700/scale+650);
X2=(int)((freq-(xmin+xmax)/2)*700/scale+350);
Y2=(int)((-magn*700/2+(ymin+ymax)/2)*700/scale+650);
line(X1,Y1,X2,Y2);
}
getchar();
closegraph();
return 0;
}

