Algoritmo Dolph-Chebychev para arrays unidimensionales
Esta función usa un algoritmo Dolph-Chebychev para obtener los pesos y fases de cada elemento de un array lineal. Los resultados de la función definen el apuntamiento del array en la dirección dada.
Cmplx[] dolph(double d, double theta, double phi, int Num, double R, int axis) { //d:element spacing in units of lambda
//theta:beam angle (in degrees)
//phi:azimut angle (in degrees)
//N:number of array elements
//R:relative sidelobe level (in dB)
//axix:indicates which axis is used-->1 for x axis
// -->2 for y axis
//This function uses a dolph-chebyshev algorithm to calculate the weights and phases in an unidirectional array of antennas
double N=Num;
int N1=N-1;
double q=R/20;
double Ra=Math.pow(10,q); //relative sidelobe level in absolute units
double b=Math.log(Ra+Math.sqrt((Math.pow(Ra,2))-1)); //b=acosh(Ra)
double x0=Math.cosh(b/N1); //scaling factor
double k;
if (axis==1){
k=(Math.sin(Math.toRadians(theta))*Math.cos(Math.toRadians(phi)));
}
if (axis==2){
k=(Math.sin(Math.toRadians(theta))*Math.sin(Math.toRadians(phi)));
}
double ang=Math.acos(k); //ang=arccos(sen(theta)*cos(phi))
double cose=Math.cos(ang);//cose=cos(ang)
double ps0=(2*Math.PI*d*cose);//find the phase that we are going to use to direct the array in the desired direction
Cmplx[] g=new Cmplx[N];
double[] x=new double[N1];
Cmplx[] psi=new Cmplx[N];
double[] y=new double[N];
double[] fase=new double[N];
Cmplx[] f=new Cmplx[N];
Cmplx[] z=new Cmplx[N1];
Cmplx[] Q=new Cmplx[N];
double[] S1=new double[N];
for (int i=1; i<N; i++){ //for i=1,...,N:
x[i-1]=Math.cos(Math.PI*(i-0.5)/N1); //find the zeros of Chebyshev polynomial
psi[i-1]=new Cmplx(0,2*Math.acos(x[i-1]/x0)); //array pattern zeros
z[i-1]=Cmplx.exp(psi[i-1]); //zeros of array polynomial
}
//This fucntion returns the coefficients of the polynomial whose roots are the elements of the vector we pass as argument.
int m=z.length; //m is the value of the length of the vector z, which is N1
Cmplx[] c=new Cmplx[m+1]; //complex vector with m+1 elements
c[0]=new Cmplx(1,0); //put the first element of c to 1
Cmplx[] caux=new Cmplx[N];//complex vector with N elements
caux[0]=new Cmplx(1,0); //put the first element of caux to 1
for (int i=1; i<=m; i++){
c[i]=new Cmplx(0,0); //initialize the rest of vector c to zeros
caux[i]=c[i]; //equate caux to c element to element
}
int t=1; //initialize t to 1
while (t<m+1){
for (int h=0; h<t; h++){ //for h=0,...,t:
Q[h]=Cmplx.mul(z[t-1],caux[h]); //put in Q[h] the result of the multiplication of z[t-1] by caux[h]
c[h+1]=Cmplx.sub(caux[h+1],Q[h]);//put in c[h+1] the result of the remainder of caux[h + 1] minus Q[h]
}
t=t+1; //increment t
for(int e=0; e<N; e++){ //for e=0,...,N:
caux[e]=c[e]; //equate caux to c element to element
}
}
for (int i=0; i<N; i++){
S1[i]=Cmplx.real(c[i]); //put in S1 the real part of the elements of c
//S1 is the vector containing the antenna array weights
}
for (int n=0; n<N; n++){
f[n]=new Cmplx(0,-((n-(N-1)/2)*ps0)); //create a complex vector, with 0 as the real part, where the imaginary part are the
//successive phases that we are going to multiply to the weights
g[n]=S1[n]*(Cmplx.exp(f[n])); //find the final result in the form of a complex number by multiplying the weights by the progressive phases,
//thus directing the array towards the direction indicated by theta and phi
y[n]=Cmplx.abs(g[n]); //find the absolute of the complexes, that is, the weights
fase[n]=(Math.atan2(g[n].imag, g[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/dolph.txt", y, fase); //write the weigths and phases in a text file
return g; //return the complex vector g, which contains the results of the algorithm
}