16,7 → 16,7 |
int obdelnik(int *pole, int delka_pole, int delka_pulsu, int spozdeni) //generuje testovaci lichobeznikovy puls do zadaneho pole |
{ |
int i; |
int value=1; |
int value=0; |
for (i=0; i <= delka_pole; i++) { |
if (i < spozdeni && i < delka_pole) pole[i]=value; |
|
24,9 → 24,9 |
|
if (i < (spozdeni+delka_pulsu+10) && i > (spozdeni+10) && i < delka_pole) pole[i]= value; |
|
if (i < (spozdeni+delka_pulsu+20) && i > (spozdeni+delka_pulsu+10) && i < delka_pole) pole[i] = value--; |
if (i < (spozdeni+delka_pulsu+19) && i > (spozdeni+delka_pulsu+10) && i < delka_pole) pole[i] = value--; |
|
if (i > (spozdeni+delka_pulsu+20) && i < delka_pole) pole[i]=value; |
if (i > (spozdeni+delka_pulsu+19) && i < delka_pole) pole[i]=value; |
} |
} |
|
65,8 → 65,8 |
double r; |
FILE *out; |
|
linear_chirp(sample,SAMPLES,100,0); // vyrobi vzorek signalu |
linear_chirp(signal,SIGNAL_SAMPLES,500,1000); // vyrobi signal ve kterem se vzorek hleda |
obdelnik(sample,SAMPLES,100,0); // vyrobi vzorek signalu |
obdelnik(signal,SIGNAL_SAMPLES,100,1100); // vyrobi signal ve kterem se vzorek hleda |
|
for(n=0; n < (SIGNAL_SAMPLES - SAMPLES);n++){ //spocita korelaci pro mozna spozdeni |
r=0; |
82,13 → 82,13 |
} |
} |
|
out=fopen("output.txt",'w'); |
for(i=0;i<SAMPLES;i++) |
out=fopen("./output.txt","w"); |
for(i=0;i< SIGNAL_SAMPLES;i++) |
{ |
// fprintf(stdout,"%3u ",i); // vypise cislo bunky v poli (spozdeni) |
fprintf(stdout,"%2i ",sample[i]); |
// fprintf(stdout,"%2i ",sample[i]); |
// fprintf(stdout,"%2d ",signal[i]); |
// fprintf(out,"%3.2f\n",correlation[i]); // vypise hodnotu korelace nejvissi cislo je nejvetsi korelace. |
fprintf(out,"%3.2f\n",correlation[i]); // vypise hodnotu korelace nejvissi cislo je nejvetsi korelace. |
} |
fprintf(stdout,"\nvzorek v signalu zacina na miste: %3u \n",delay); |
fclose(out); |