# Dolph-Chebychev algorithm for bidimensional arrays

This function uses a Dolph-Chebychev algorithm to obtain the weights and phases of each element in a bidimensional array. The results of the function define the pointing of the array in the given direction.

``````void bidirectional_dolph(double d1, int N1, double R1, double d2, int N2, double R2, double theta, double phi) {  //d1:element spacing of array x in units of lambda
//N1:number of array elements of array x
//R1:relative sidelobe level (in dB) in array x in units of lambda
//d2:element spacing of array y
//N2:number of array elements of array y
//R2:relative sidelobe level (in dB) in array y
//theta:beam angle (in degrees)
//phi:azimut angle (in degrees)

//This function uses a dolph-chebyshev algorithm to calculate the weights and phases in an bidirectional array of antennas

int N=N1*N2;
Cmplx[] a=new Cmplx[N1];
Cmplx[] b=new Cmplx[N2];
Cmplx[][] c=new Cmplx[N1][N2];
Cmplx[] pesos=new Cmplx[N];

a=dolph(d1, theta, phi, N1, R1, 1);   //call to the dolph_1.java and store in a the results (complex numbers) of the array in x
b=dolph(d2, theta, phi, N2, R2, 2); //call to the dolph_1.java and store in b the results (complex numbers) of the array in y

double[] fase=new double[N];
double[] y=new double[N];     //vectors of N elements double type

int cont=0; //initialize cont to 0
for (int i=0; i<N1; i++){
for (int j=0; j<N2; j++){
c[i][j]=a[i]*b[j];     //multiply the values of array x and array y to obtain the two-directional results
pesos[cont]=c[i][j];   //store these results in order
cont=cont+1;           //increment cont
}
}

for (int n=0; n<N; n++){
y[n]=(Cmplx.abs(pesos[n])); //find the absolute of the complexes, that is, the weights
fase[n]=(Math.atan2(pesos[n].imag, pesos[n].real)); //find the phase in radians
if (fase[n]<0){ /// if the phase is less than 0