theta = (-180:0.1:180);
%图1.不同阵元数目的线阵天线方向图
[AF1] = N_matlab_tcwang(5,0.5,0);
[AF2] = N_matlab_tcwang(10,0.5,0);
[AF3] = N_matlab_tcwang(20,0.5,0);
% 绘制方向图
AF1=AF1/max(AF1);
AF2=AF2/max(AF2);
AF3=AF3/max(AF3);
subplot(3,2,1);
plot(theta,AF1,'r',theta,AF2,'k',theta,AF3,'g'); % 绘制方向图
legend('5阵元','10阵元','20阵元');
grid on;
xlabel('角度(度)'); ylabel('归一化电压幅度'); title('图1.不同阵元数目的线阵天线方向图');
xlim([-180 180 ]);
AF1=20*log10(AF1/max(AF1));
AF2=20*log10(AF2/max(AF2));
AF3=20*log10(AF3/max(AF3));
subplot(3,2,2);
plot(theta,AF1,'r',theta,AF2,'k',theta,AF3,'g'); % 绘制方向图
legend('5阵元','10阵元','20阵元');
grid on;
xlabel('角度(度)'); ylabel('归一化电压幅度(dB)'); title('图2.不同阵元数目的线阵天线方向图');
xlim([-180 180 ]);ylim([-100 0]);
[AF1] = N_matlab_tcwang(10,0.25,0);
[AF2] = N_matlab_tcwang(10,0.5,0);
[AF3] = N_matlab_tcwang(10,1,0);
% 绘制方向图
AF1=AF1/max(AF1);
AF2=AF2/max(AF2);
AF3=AF3/max(AF3);
subplot(3,2,3);
plot(theta,AF1,'r',theta,AF2,'k',theta,AF3,'g'); % 绘制方向图
legend('d=0.25*lambda','d=0.5*lambda','d=1*lambda');
grid on;
xlabel('角度(度)'); ylabel('归一化电压幅度'); title('图3.不同阵元间距的线阵天线方向图');
xlim([-180 180 ]);
AF1=20*log10(AF1/max(AF1));
AF2=20*log10(AF2/max(AF2));
AF3=20*log10(AF3/max(AF3));
subplot(3,2,4);
plot(theta,AF1,'r',theta,AF2,'k',theta,AF3,'g'); % 绘制方向图
legend('d=0.25*lambda','d=0.5*lambda','d=1*lambda');
grid on;
xlabel('角度(度)'); ylabel('归一化电压幅度/dB'); title('图4.不同阵元间距的线阵天线方向图');
xlim([-180 180 ]);ylim([-100 0]);
[AF1] = N_matlab_tcwang(10,0.5,-60);
[AF2] = N_matlab_tcwang(10,0.5,0);
[AF3] = N_matlab_tcwang(10,0.5,30);
% 绘制方向图
AF1=AF1/max(AF1);
AF2=AF2/max(AF2);
AF3=AF3/max(AF3);
subplot(3,2,5);
plot(theta,AF1,'r',theta,AF2,'k',theta,AF3,'g'); % 绘制方向图
legend('-60°','0°','30°');
grid on;
xlabel('角度(度)'); ylabel('归一化电压幅度'); title('图5.不同主瓣指向的线阵天线方向图');
xlim([-180 180 ]);
AF1=20*log10(AF1/max(AF1));
AF2=20*log10(AF2/max(AF2));
AF3=20*log10(AF3/max(AF3));
subplot(3,2,6);
plot(theta,AF1,'r',theta,AF2,'k',theta,AF3,'g'); % 绘制方向图
legend('-60°','0°','30°');
grid on;
xlabel('角度(度)'); ylabel('归一化电压幅度/dB'); title('图6.不同主瓣指向的线阵天线方向图');
xlim([-180 180 ]);ylim([-100 0]);