📄 sa_fig4_16.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% ****************************************************** %%%% * Smart Antennas for Wireless Applications w/ Matlab * %%%% ****************************************************** %%%% %%%% Chapter 4: Fig 4.16 & 4.17 %%%% %%%% Author: Frank Gross %%%% McGraw-Hill, 2005 %%%% Date: 4/24/2005 %%%% %%%% This code creates Figures 4.16 & 4.17, plots of Hanning %%%% array weights for N = 8 ULA & the corresponding %%%% weighted array factor vs. unweighted array factor. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%------------------- Define Variables:---------------------%%% N - number of array elements %% d - array element spacing (wavelengths) %% theta - angle (deg) %% check - check to see if even or odd array %% wb - binomial array weights of length N %% AF - array factor of N element array %% AFn - normalized array factor of N element array %%%----------------------------------------------------------%%%%----- Given Values -----%%N = 8; d = 0.5; theta = -pi/2:.01:pi/2; ang = theta*180/pi;test = hamming(N);check = mod(N,2);%%----- Produce Weighted Array Factor For Even or Odd Array -----%%if check == 0 % if array is even wB = flipud(test(1:N/2)); wB = wB/max(wB); figure(1) stem(test/max(test),'k') xlabel('Element Number'), ylabel('Array Weights') title('\bfFigure 4.16 - Hanning Array Weights vs. Element Number') axis([1 N 0 1.1]) AF = 0; tot = sum(wB); for i = 1:N/2 AF = AF + wB(i)*cos((2*i-1)*pi*d*sin(theta)); endelse % if array is odd wB = flipud(test(1:(N-1)/2+1)); wB = wB/max(wB); figure(1) stem(test/max(test),'k') xlabel('Element Number'), ylabel('Array Weights') axis([1 N 0 1.1]) AF = 0; tot = sum(wB); for i = 1:(N-1)/2+1 AF = AF + wB(i)*cos(2*(i-1)*pi*d*sin(theta)); endendAFn = sin(N*pi*d*sin(theta))./(N*pi*d*sin(theta));%%----- Plot Results -----%%figure(2), plot(ang,abs(AF)/tot,'k', ang,abs(AFn),'k:')xlabel('\theta (deg)'), ylabel('|AF|')title('\bfFigure 4.17 - Hanning Weighted Array Factor vs. Angle')axis([-90 90 0 1.1]), grid onset(gca,'xTick',[-90:30:90])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -