Subversion Repositories svnkaklik

Compare Revisions

Ignore whitespace Rev 542 → Rev 543

/programy/C/ix86/sound/plot.gn
1,6 → 1,4
!./sonar
set xrange [0:3000]
set autoscale y
set size 1,1
set origin 0,0
set multiplot
7,12 → 5,17
 
set size 1,0.2
set origin 0,0.8
set xrange [0:1000]
plot "./output.txt" using 1:($2/2) with lines title 'chirp'
set size 1,0.4
set origin 0,0.4
set xrange [0:10000]
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/1000) with lines title 'L correlation', "" using 1:($4/1000) with lines title 'R correlation'
set xrange [0:10000]
#set yrange [-200000:200000]
set autoscale y
plot "" using 1:($5/1000) with lines title 'L correlation', "" using 1:($6/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
189,7 → 189,7
unsigned int maxval = (1 << (snd_pcm_format_width(format) - 1)) - 1;
 
static const float f0 = 1000;
static const float fmax = 10000;
static const float fmax = 7000;
static const float Tw = 0.002;
static float k;
 
413,11 → 413,13
j+=2;
}
 
// linear_windowed_chirp(L_signal,1000000, 1000);
 
printf("\nData transmitted... \ncorrelating...\n");
for(n=0; n < (SIGNAL_SAMPLES - chirp_size);n++){
l=0;
r=0;
for(m=CHIRP_OFFSET;m < 500;m++)
for(m=CHIRP_OFFSET;m < chirp_size;m++)
{
l += chirp[m]*L_signal[m+n]; // correlate with left channel
r += chirp[m]*R_signal[m+n]; // correlate with right channel
426,7 → 428,7
correlationr[n]=r;
}
 
/* printf("\nSearching echos...\n");
printf("\nSearching echos...\n");
r=0;
l=0;
for(n=0; n < (SIGNAL_SAMPLES - chirp_size);n++){ //najde nejvetsi korelace
438,11 → 440,11
delay[2] = n;
r = correlationr[n];
}
}*/
}
 
out=fopen("./output.txt","w");
j=0;
for(i=0;i<=60000;i++){
for(i=0;i<=100000;i++){
fprintf(out,"%6d %6d %6d %6d %9ld %9ld\n",i,chirp[i],L_signal[i],R_signal[i],correlationl[i], correlationr[i]);
j+=2;
}