Subversion Repositories svnkaklik

Compare Revisions

Ignore whitespace Rev 540 → Rev 541

/programy/C/ix86/sound/plot.gn
13,6 → 13,6
plot "" using 1:($3*5-1000) with lines title 'L echo', "" using 1:($4*5+1000) with lines title 'R echo'
set size 1,0.4
set origin 0,0.0
plot "" using 1:($4/5000) with lines title 'L correlation', "" using 1:($4/5000) with lines title 'R correlation'
plot "" using 1:($4/1000) with lines title 'L correlation', "" using 1:($4/1000) with lines title 'R correlation'
pause 1
reread
/programy/C/ix86/sound/sonar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/programy/C/ix86/sound/sonar.c
26,6 → 26,7
 
#define SOUND_SPEED 340
#define SIGNAL_SAMPLES 100000
#define CHIRP_OFFSET 300
 
unsigned int chirp_size;
 
300,7 → 301,7
int count;
unsigned int i,j,m,n;
unsigned int delay[10]; //store delay of signifed correlation
double l,r; // store correlation at strict time
long int l,r; // store correlation at strict time
long int correlationl[100000]; //array to store correlation curve
long int correlationr[100000]; //array to store correlation curve
 
343,7 → 344,7
 
/// generate ping pattern
 
chirp_size=linear_windowed_chirp(chirp,1000000, 200);
chirp_size=linear_windowed_chirp(chirp,1000000, CHIRP_OFFSET);
 
/// register playback callback
err = snd_async_add_pcm_handler(&phandler, playback_handle, async_playback_callback, &data); // fill by dummy &data
408,7 → 409,7
l=0;
r=0;
j=0;
for(m=0;m < chirp_size;m++)
for(m=CHIRP_OFFSET;m < chirp_size;m++)
{
l += chirp[m]*signal[i+j]; // correlate with left channel
r += chirp[m]*signal[i+j+1]; // correlate with right channel
419,7 → 420,7
i+=2;
}
 
/* printf("\nFinding echos...\n");
printf("\nSearching echos...\n");
r=0;
l=0;
for(n=0; n < (SIGNAL_SAMPLES - chirp_size);n++){ //najde nejvetsi korelace
428,14 → 429,14
l = correlationl[n];
}
if (r < correlationr[n]){
delay[1] = n;
delay[2] = n;
r = correlationr[n];
}
}*/
}
 
out=fopen("./output.txt","w");
j=0;
for(i=0;i<=100000;i++){
for(i=0;i<=60000;i++){
fprintf(out,"%6d %6d %6d %6d %9ld %9ld\n",i,chirp[i],signal[j],signal[j+1],correlationl[i], correlationr[i]);
j+=2;
}