微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 天线设计和射频技术 > beaforming

beaforming

时间:04-09 整理:3721RD 点击:
i need help on my coding since i cant figure out which part is the mistake since i can seem to get the output i want...

function[]=arrays;
clear all;
close all;
clc;
clf;

k=2*pi;
Mx=5;
Ny=5;
dx=0.25;
dy=0.25;
thmax2=0;
phimax2=0;
dtor=pi/180;
theta=linspace(1,180,180);
phi=linspace(1,180,180);

betax=-k*dx*sin(dtor*thmax2)*cos(dtor*phimax2);
betay=-k*dy*sin(dtor*thmax2)*sin(dtor*phimax2);

[THETA,PHI]=meshgrid(theta,phi);
AF3=afnf(THETA,PHI,Mx,Ny,dx,dy,betax,betay);
spherical_plot(AF3,THETA,PHI)
ss=title('3D Spherical plot of Array Factor','Fontsize',15);
figure
rect_plot(AF3)

%spherical plot
function spherical_plot(r,THETA,PHI)
dtor=pi/180;
x=abs(r).*sin(THETA*dtor).*cos(PHI*dtor);
y=abs(r).*sin(THETA*dtor).*sin(PHI*dtor);
z=abs(r).*cos(THETA*dtor);
surf(x,y,z);
view(0,180);
C=[.8,.8,.8]; colormap(C); axis off equal;

function rect_plot(r)
S=abs(r);
% mesh(-1*(length(S)/2-1):1:length(S)/2,-1*(length(S)/2-1):1:length(S)/2,S/norm(S))
% mesh(-179:1:179,-45:1:45,S/norm(S))
mesh(-89:1:90,-89:1:90,S/norm(S));

%mesh(-45:1:45,-179:1:179,S/norm(S));

title('Rectangular Plot Planar Array Radiation Pattern')
xlabel('Angle theta -xaxis indexed m, in Degrees')
ylabel('Angle phi -yaxis indexed n, in Degrees')
zlabel('Normalized Amlitude')

function[f10]=afnf(theta1,phi1,Mx,Ny,dx,dy,betax,betay)
k=2*pi;
dtor=pi/180;
AFx1(Mx)=30;
AFy1(Ny)=30;
for theta=1:1:180;
for phi=1:1:180;
elementx=1;
elementy=1;
AFx1(elementx)=0;
AFy1(elementy)=0;
AXF=0;
psix=k*dx*sin(theta*dtor-pi/2)*cos(phi*dtor-pi/2)+betax;
psiy=k*dy*sin(theta*dtor-pi/4)*sin(phi*dtor-pi/2)+betay;
for elementx=1:Mx;
AFx2(elementx)=exp(i*elementx*psix);
AFx3(elementx)=AFx2(elementx)+AFx1(elementx);
AFx1(elementx+1)=AFx3(elementx);
end;

AXF=AFx1(Mx);
for elementy=1:Ny;
AFy2(elementy)=exp(i*elementy*psiy)*AXF;
AFy3(elementy)=AFy2(elementy)+AFy1(elementy);
AFy1(elementy+1)=AFy3(elementy);
end;
AYF=AFy1(Ny);
AF(phi,theta)=AYF;
end;
end;

f10=AF;

which output do you want?

I have tried your code and it seems to be working fine..

PLESE CHECK THE ERROR AND FIGURE IT OUT


i suppose to get the rectangular plot planay array radiation pattern like the coding below...

clear all;
clc;
NGrid=100;
xMax=5;
yMax=xMax;
for i=1:NGrid;
xPlot(i)=-xMax+(i-1)/(NGrid-1)*(2*xMax);
yPlot(i)=-yMax+(i-1)/(NGrid-1)*(2*yMax);
end

for i=1:1:NGrid
y=yPlot(i);
for j=1:1:NGrid
x=xPlot(j);
EPlot(i,j)=sin(pi*x)*sin(pi*y)/(pi*pi*x*y);
end
end
mesh(xPlot,yPlot,EPlot);

but somehow i dont know how to apply it... You see, from the theory the graph from my own coding is not the right output...

Added after 28 minutes:

below are two equations i use in my matlab coding...

hi man , I do not have time to check your programme, but here atteched is the code that I use to plot 3d rectangular array.
you can just remove the weightning w to get a uniforme array I just hpe that it helped you.

Code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%Rayonnement 2D par Dolph-Chebyshev%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%processing the array for a rectangular array of Nx*Ny antennas, with
%respectively dx and dy spacing along the x and y axis, with  a SLR of Rdb
%with dolph chebychev wieghtning

function Cheb_2D(Nx,Ny,dx,dy,Rdb)

dir_theta=20;
dir_phi=30;

dir_ux = sin((dir_theta/180)*pi)*cos((dir_phi/180)*pi);
dir_uy = sin((dir_theta/180)*pi)*sin((dir_phi/180)*pi);
%%%%%%Calcul des coefs de Cheb correspondants au reseau%%%%
w=planar_dolphcheby(dx, dy, Nx, Ny, Rdb);

%%%utilisation de ces coefs pour le calcul du facteur reseau%%%%%%%%%

%%%%%%%%%Cas paire%%%%%%%%%%%%%%%%%%%%%%%
odd = rem(Nx,2);
if (odd)
    hh = waitbar(0,'Processing...');
    ux_grid = -1:0.01:1;
    uy_grid = -1:0.01:1;
    for x = 1:length(ux_grid)
         waitbar(x/length(ux_grid));
         ux = ux_grid(x);
            for y = 1:length(uy_grid)
    
              uy = uy_grid(y);
                B(x, y) = 0;
                M=fix(Nx/2);
                    for n = -M:M
                        for m = -M:M
    B(x, y) = B(x, y)+w(n+M+1,m+M+1)*exp(j*2*pi*(n*ux*dx+m*uy*dy))*exp(j*2*pi*(n*dir_ux*dx+m*dir_uy*dy));
                        end
                    end
               end
    end
close(hh)


else
  
     hh = waitbar(0,'Processing...');
    ux_grid = -1:0.01:1;
    uy_grid = -1:0.01:1;
    for x = 1:length(ux_grid)
         waitbar(x/length(ux_grid));
         ux = ux_grid(x);
            for y = 1:length(uy_grid)
    
              uy = uy_grid(y);
                B(x, y) = 0;
                        for m = 1:Nx
                        for n = 1:Ny
B(x, y) = B(x, y)+w(m,n)*exp(-j*2*pi*(m*ux*dx+n*uy*dy))*exp(j*2*pi*(m*dir_ux*dx+n*dir_uy*dy));
                        end
                    end
               end
    end
close(hh)
    
end   
    
    B = abs(B)/max(max(abs(B)));
    size(B);
grid on
surf(ux_grid, uy_grid, (20*log10(B))');
axis([-1 1 -1 1 -70 0])

im sori but somehow i get error when running this coding... huhuhu... help...

By the way this is the error that sasamdyu gets:

"Function definitions are not permitted at the prompt or in scripts"

searching on google it seems that functions cannot be placed inside scripts. anyone know how to solve this error?

i have tried running the code above but i got the error msg like below:

Error in ==> Cheb_2D at 16
w=planar_dolphcheby(dx, dy, Nx, Ny, Rdb);


do you know how to solve the error? or anyone?

hello.. somehow i still cant run the coding u gave me... help...

Added after 6 minutes:

hello Alberich... u gave me this coding but somehow i cant run the program.. help...


Code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%Rayonnement 2D par Dolph-Chebyshev%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%processing the array for a rectangular array of Nx*Ny antennas, with

%respectively dx and dy spacing along the x and y axis, with  a SLR of Rdb

%with dolph chebychev wieghtning



function Cheb_2D(Nx,Ny,dx,dy,Rdb)



dir_theta=20;

dir_phi=30;



dir_ux = sin((dir_theta/180)*pi)*cos((dir_phi/180)*pi);

dir_uy = sin((dir_theta/180)*pi)*sin((dir_phi/180)*pi);

%%%%%%Calcul des coefs de Cheb correspondants au reseau%%%%

w=planar_dolphcheby(dx, dy, Nx, Ny, Rdb);



%%%utilisation de ces coefs pour le calcul du facteur reseau%%%%%%%%%



%%%%%%%%%Cas paire%%%%%%%%%%%%%%%%%%%%%%%

odd = rem(Nx,2);

if (odd)

   hh = waitbar(0,\'Processing...\');

   ux_grid = -1:0.01:1;

   uy_grid = -1:0.01:1;

   for x = 1:length(ux_grid)

        waitbar(x/length(ux_grid));

        ux = ux_grid(x);

           for y = 1:length(uy_grid)



             uy = uy_grid(y);

               B(x, y) = 0;

               M=fix(Nx/2);

                   for n = -M:M

                       for m = -M:M

   B(x, y) = B(x, y)+w(n+M+1,m+M+1)*exp(j*2*pi*(n*ux*dx+m*uy*dy))*exp(j*2*pi*(n*dir_ux*dx+m*dir_uy*dy));

                       end

                   end

              end

   end

close(hh)





else



    hh = waitbar(0,\'Processing...\');

   ux_grid = -1:0.01:1;

   uy_grid = -1:0.01:1;

   for x = 1:length(ux_grid)

        waitbar(x/length(ux_grid));

        ux = ux_grid(x);

           for y = 1:length(uy_grid)



             uy = uy_grid(y);

               B(x, y) = 0;

                       for m = 1:Nx

                       for n = 1:Ny

B(x, y) = B(x, y)+w(m,n)*exp(-j*2*pi*(m*ux*dx+n*uy*dy))*exp(j*2*pi*(m*dir_ux*dx+n*dir_uy*dy));

                       end

                   end

              end

   end

close(hh)



end



   B = abs(B)/max(max(abs(B)));

   size(B);

grid on

surf(ux_grid, uy_grid, (20*log10(B))\');

axis([-1 1 -1 1 -70 0])
[/quote]

Added after 2 minutes:

i tried running this above program but get this error.. what should i do...

? Error: File: New.m Line: 15 Column: 17
Unexpected MATLAB operator.
上一篇:hf transformer design
下一篇:最后一页

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top