Scripts and User Functions Center

Binomial algorithm for bidimensional arrays

This function uses a binomial 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_binomial(double d1, int N1, double d2, int N2, double theta, double phi) {  //d1:element spacing of array x in units of lambda
											                                        //N1:number of array elements of array x
											                                        //d2:element spacing of array y in units of lambda
											                                        //N2:number of array elements of array y
											                                        //theta:beam angle (in degrees)
											                                        //phi:azimut angle (in degrees)
											                                        
//This function uses a binomial 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=binomial(d1, theta, phi, N1, 1);   //call to the funcion_binomial.java and store in a the results (complex numbers) of the array in x
	b=binomial(d2, theta, phi, N2, 2); //call to the funcion_binomial.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
			fase[n]=2*Math.PI+fase[n]; //add 2*pi
			}
		fase[n]=Math.toDegrees(fase[n]); //find the phase in degrees
	}

	writeFile("./mydatafiles/binomial_bi.txt", y,fase); //write the weigths and phases in a text file

	
}

Did you find this information useful?

We use cookies on this website to improve your navigation experience on this site. By using this site, you agree to our cookie policy.

I agree