Subversion Repositories svnkaklik

Compare Revisions

Regard whitespace Rev 646 → Rev 647

/programy/C/ix86/echo/SW/signal.gp
10,6 → 10,6
set key off
#set ytics 1e9
 
splot "/tmp/plane_cut.txt" matrix
splot "/tmp/plane_cut.txt"
pause 1
reread
/programy/C/ix86/echo/SW/sonar/src/.deps/sonar.Po
1,11 → 1,11
sonar.o: sonar.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/bits/predefs.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
/usr/include/gnu/stubs-64.h \
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/include/stddef.h \
/usr/include/gnu/stubs-32.h \
/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/include/stdarg.h \
/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdio.h /usr/include/bits/stdio2.h \
/usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
52,9 → 52,9
 
/usr/include/gnu/stubs.h:
 
/usr/include/gnu/stubs-64.h:
/usr/include/gnu/stubs-32.h:
 
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/include/stddef.h:
/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h:
 
/usr/include/bits/types.h:
 
66,7 → 66,7
 
/usr/include/wchar.h:
 
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/include/stdarg.h:
/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h:
 
/usr/include/bits/stdio_lim.h:
 
/programy/C/ix86/echo/SW/sonar/src/sonar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/programy/C/ix86/echo/SW/sonar/src/sonar.c
207,11 → 207,12
int *L_signal, *R_signal;
short *chirp, *signal;
float *chirp_spect, *lecho_spect, *recho_spect;
float x,y;
float a,b;
unsigned int i,j,m,n;
unsigned int delayl[10],delayr[10]; //store delay of signifed correlation
long int l,r; // store correlation at strict time
double df; //frequency resolution
double k; // sample numbers to distance normalising constant
unsigned int frequency_bins; // number of output frequency bins
 
double *inchirp;
274,8 → 275,10
R_signal = malloc(period_size * sizeof(int));
chirp = calloc(2*period_size, sizeof(short));
signal = malloc(2*period_size * sizeof(short));
echo_map = malloc(3*period_size * sizeof(float)); // Array to store two dimensional image of echos
echo_map = malloc(3*period_size*period_size * sizeof(float)); // Array to store two dimensional image of echos
if (echo_map == NULL) printf("Can't allocate enought memory");
 
k = SOUND_SPEED/rate;
// generate ping pattern
chirp_size = linear_windowed_chirp(chirp);
 
365,18 → 368,18
 
m=0;
printf("Building echo map\n"); // compute map from left and right correlation data
for (i=0;i < period_size; i++)
for (i=0;i < period_size; i+=10)
{
for(j=0;j < period_size; j++)
a=k*i;
for(j=0;j < period_size; j+=10)
{
echo_map[m]=(i*i-j*j+APERTURE*APERTURE)/(2*APERTURE);
echo_map[m+1]=sqrt(-(i-j-APERTURE)*(i+j-APERTURE)*(i-j+APERTURE)*(i+j+APERTURE))/(2*r);
b=k*j;
echo_map[m]=(a*a-b*b+APERTURE*APERTURE)/(2*APERTURE);
echo_map[m+1]=sqrt((a-b-APERTURE)*(a+b-APERTURE)*(a-b+APERTURE)*(a+b+APERTURE))/(2*r);
echo_map[m+2]=correlationl[i]*correlationr[j];
m+=3;
}
}
 
 
printf("Searching echos\n");
r=0;
l=0;
409,17 → 412,18
out=fopen("/tmp/sonar.txt","w");
for (i=0; i <= (period_size - 1); i++)
{
fprintf(out,"%2.3f %6d %6d %9ld %9ld\n",SOUND_SPEED * (float) i / rate,L_signal[i],R_signal[i],correlationl[i], correlationr[i]);
fprintf(out,"%2.3f %6d %6d %9ld %9ld\n", (float)i*k, L_signal[i], R_signal[i], correlationl[i], correlationr[i]);
}
fclose(out);
 
j=0;
out=fopen("/tmp/plane_cut.txt","w"); // writes plane cut - e.g. density map to file
for (i=0;i < period_size; i++)
for (i=0;i < period_size*period_size; i++)
{
fprintf(out,"%3.2f %3.2f %3.2f\n", echo_map[j], echo_map[j+1], echo_map[j+2]);
fprintf(out,"%3.3f %3.3f %3.3f\n", echo_map[j], echo_map[j+1], echo_map[j+2]);
j+=3;
}
fclose(out);
 
out=fopen("/tmp/chirp.txt","w");
for (i=0; i <= (chirp_size - 1); i++)