function [Power,vr_az,pos,index]=antenna_position(V, full_encoder, PRF, freq)

c=3e8;
lambda=c/(freq);
T=1/PRF;

section=0:6:511;

for azi=1:length(section)-1
    u_az=find(full_encoder >= section(azi) & full_encoder < section(azi+1));
    
    if length(u_az) < 50
        Power(:,azi)=NaN;
        I(:,azi)=NaN;
        Q(:,azi)=NaN;
    else
        V_temp=V(:,u_az);
        
        Power(:,azi)=sum(V_temp.*conj(V_temp),2)/length(u_az);
        R11=(1/(length(u_az)-1))*sum(V_temp(:,2:length(u_az)).*conj(V_temp(:,1:length(u_az)-1)),2);
        I(:,azi)=real(R11);
        Q(:,azi)=imag(R11);
    end
end

[maxi,index]=max(Power(100:250,:));
index=index+100-1;

for azi=1:length(section)-1
    vr_az(azi)=(lambda/(4*pi*T))*atan2((-Q(index(azi),azi)),I(index(azi),azi));
end

[mini,pos]=min(vr_az);
[maxi,index]=max(Power(100:250,pos));
index=index+100-1;