1:设置 matlab 画图格式
clear;clc; % load("array.mat"); % Bestallarray=array; % rllofcircle(Bestallarray) %求阵列方向图以及峰值旁瓣电平 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%优化结果展示%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Bestallarray=polarPosition(); rll=rllofcircle(Bestallarray) %-----导出方向图 N_sam=1024; %采样点数 ,在ovalRSLLofCircle中是100 % u=-1*MULTI:(2/N_sam)*MULTI:(1-2/N_sam)*MULTI; %u=sin(sita)*cos(fai),U轴 u=-1:2/N_sam:1-2/N_sam;%u=sin(sita)*cos(fai),U轴 v=-1:2/N_sam:1-2/N_sam; %v=sin(sita)*sin(fai),V轴 u1=-1:2/N_sam:0;%u=sin(sita)*cos(fai),U轴 v1=-1:2/N_sam:0; %v=sin(sita)*sin(fai),V轴 [X,Y]=meshgrid(u,v); [X1,Y1]=meshgrid(u1,v1); FF=zeros(N_sam,N_sam);%采样矩阵 lamda=1;%波长 fun_x=find(Bestallarray~=0); %得到的结果为一列向量,有阵元的位置索引值,维数一般比quartered_matrix低,就是把 %没有阵元的位置去掉 q_position=[real(Bestallarray(fun_x)) imag((Bestallarray(fun_x)))]; %得到的结果为二维列向量,第一列幅值,第二列相位,行数和fun_x一样 %-----下面这段代码就是方向图的计算 公式(2)和(3)只是转换为在直角坐标下面计算 for n=1:N_sam for m=1:N_sam if abs(v(m))<=sqrt(1-(u(n))^2)% 数学推导合理性保证,限定在单位圆内部 temp=0; for a=1:length(fun_x)%把所有阵元的用上的,所以应该是整个圆平面 temp=temp+exp(j*2*pi*q_position(a,1)*(cos(q_position(a,2))*u(n)+sin(q_position(a,2))*v(m))); %q_position(a,1)=半径,q_position(a,2)=角度0-2pi end FF(n,m)=temp;%加上圆心 else end end end FF(find(FF==0))=eps; %eps是非常小的一个数 ff=20*log10(abs(FF)/max(max(abs(FF))));%%归一化 bottom=-40;%设置底平台电平 ff(find(ff<=-40))=bottom;%最低电平设置为-80db %when fai=0 ---ff(m,:) ---u axis %when fai=90 ---ff(:,m) ---v axis when fai=45----u=v m=ceil(find(ff==max(max(ff)))/N_sam);%在一个100*100的矩阵中找到最大值的位置 fai0=ff(m,:); fai90=ff(:,m); % %-----uv图 % figure % % plot(u(1:5:end),fai0(1:5:end),'--g','LineWidth',1); % plot(u,fai0,'--g','LineWidth',0.8); % hold on % % plot(v(1:5:end),fai90(1:5:end),':m','LineWidth',2); % plot(v,fai90,'--r','LineWidth',2); % legend('u=0','v=0'); % % %ylabel('F(u,v)/dB'); % %xlabel('μ,ν'); % % figure_FontSize=12; % % set(get(gca,'XLabel'),'FontSize',figure_FontSize); % % set(get(gca,'YLabel'),'FontSize',figure_FontSize); % % set(findobj('FontSize',12),'FontSize',figure_FontSize); % % set(findobj(get(gca,'Children'),'LineWidth',0.5),'LineWidth',2); % % xlabel('\theta'); % % ylabel('Radiation pattern (dB)'); % ylabel('阵列响应/dB'); % xlabel('{\itu},{\itv}'); % text(0.3,-10,'采样点数:1024','horiz','left','color','b','fontsize',12) % text(0.3,-12,'PSLL:-13.33dB','horiz','left','color','b','fontsize',12) % % set(gca,'FontSize',12); % 设置坐标轴字体大小 % %-----方向图 % figure % mesh(X,Y,ff);%画出曲面图 % shading interp; % % colormap(gray); % % plot(Array(:,1)',Array(:,2)','*'); % %-----导出最优阵列 % % [Array]=ArrayGroup(Population_Init,circle_num,1,element_space); % % Bestallarray=Array; % xlabel('{\itu}=sin\theta cos φ'); % ylabel('{\itv}=sin\theta sin φ'); % % zlabel('Radiation pattern(dB)'); % zlabel('阵列响应/dB'); % % % set(gca,'FontSize',12); % 设置坐标轴字体大小 % % % %-----第一象限方向图 % figure % mesh(X1,Y1,ff(1:(length(u)/2+1),1:(length(u)/2+1)));%画出曲面图 % shading interp; % % colormap(gray); % % plot(Array(:,1)',Array(:,2)','*'); % %-----导出最优阵列 % % [Array]=ArrayGroup(Population_Init,circle_num,1,element_space); % % Bestallarray=Array; % xlabel('{\itu}=sin\theta cos φ','FontSize',12); % ylabel('{\itv}=sin\theta sin φ','FontSize',12); % % zlabel('Radiation pattern(dB)'); % zlabel('阵列响应/dB','FontSize',12); % % set(gca,'FontSize',12); % 设置坐标轴字体大小 %-----uv图 figure plot(u,fai0,'--b','LineWidth',0.8); hold on plot(v,fai90,'--r''LineWidth',2); % % plot(u(1:5:end),fai0(1:5:end),'--g','LineWidth',1); % plot(u,fai0,'--g','LineWidth',0.8); lg=legend('{\itu}=0','{\itv}=0'); set(lg,'Fontname', 'Times New Roman','FontWeight','bold','FontSize',12) %设置legend的字体大小 %ylabel('F(u,v)/dB'); %xlabel('μ,ν'); figure_FontSize=12; set(get(gca,'XLabel'),'FontSize',figure_FontSize); set(get(gca,'YLabel'),'FontSize',figure_FontSize); set(findobj('FontSize',12),'FontSize',figure_FontSize); set(findobj(get(gca,'Children'),'LineWidth',0.5),'LineWidth',2); % xlabel('\theta'); % ylabel('Radiation pattern (dB)'); ylabel('阵列响应/dB','fontsize',12); xlabel('{\itu},{\itv}','fontsize',12); text(0.37,-8.4,'采样点数:1024','horiz','left','color','b','fontsize',12) text(0.37,-10.5,'PSLL:-13.33dB','horiz','left','color','b','fontsize',12) %-----方向图 figure mesh(X,Y,ff);%画出曲面图 shading interp; % colormap(gray); % plot(Array(:,1)',Array(:,2)','*'); %-----导出最优阵列 % [Array]=ArrayGroup(Population_Init,circle_num,1,element_space); % Bestallarray=Array; xlabel('u=sin\theta cos φ','fontsize',12); ylabel('v=sin\theta sin φ','fontsize',12); % zlabel('Radiation pattern(dB)'); zlabel('阵列响应/dB','fontsize',12); %-----第一象限方向图 figure mesh(X1,Y1,ff(1:(length(u)/2+1),1:(length(u)/2+1)));%画出曲面图 shading interp; % colormap(gray); % plot(Array(:,1)',Array(:,2)','*'); %-----导出最优阵列 % [Array]=ArrayGroup(Population_Init,circle_num,1,element_space); % Bestallarray=Array; xlabel('u=sin\theta cos φ','fontsize',12); ylabel('v=sin\theta sin φ','fontsize',12); % zlabel('Radiation pattern(dB)'); zlabel('阵列响应/dB','fontsize',12);