修改好的matlab程序
1 function I = taylor_line(N, SLL) 2 3 M = 10000; 4 d = 1/2; 5 L = (N)*d;% antenna length 6 theta = 0:pi/M:pi;% 7 % theta = linspace(-pi/2,pi/2,M+1) 8 x = L*cos(theta); 9 f0 = 1e9; 10 %lambda = 3e8/f0; 11 %d = lambda/2;% elements spacing 12 k =2*pi;% wave constant 13 R = 20; % amplitude ration between mainbeam and sidelobe , dB 14 A = acosh(10^(-SLL/20))/pi; 15 % T = cos(pi*sqrt(x.^2-A^2)); 16 % af = 20*log10(abs(T)/max(T)); 17 % error = 0.001; 18 % % af=U; 19 % pos1_3dB = []; 20 % pos_max = find(max(af)==af); 21 % while(isempty(pos1_3dB)) 22 % pos1_3dB = find(abs(((af(1:pos_max)-af(pos_max)))+3) < error); 23 % error = error + 0.001; 24 % end 25 % error = 0.001; 26 % pos2_3dB = []; 27 % while(isempty(pos2_3dB)) 28 % pos2_3dB = find(abs(((af(pos_max:end)-af(pos_max)))+3) < error); 29 % error = error + 0.001; 30 % end 31 % BeamWidth= (theta(pos2_3dB(1)+pos_max)-theta(pos1_3dB(end)))/pi*180; 32 % figure; 33 % plot(theta,af); 34 % hold on; 35 % str = strcat('L=', num2str(L),'lambda, SLL = -',num2str(R) ,'dB '); 36 % bw = strcat('mainbeam beamwidth=',num2str(BeamWidth),'degree '); 37 % text(pi*2/3,-5,str,'fontsize',12); 38 % text(pi*2/3,-8,bw,'fontsize',12); 39 % title('Radiation Pattern of an Idealized Equvialent Sidelobe Array '); 40 % xlabel('Phase'); 41 % ylabel('Amplitude'); 42 % ylim([-60 0]); 43 %% 44 % Taylor synthesis 45 % theta = -pi/2:0.01:pi/2;% 46 % x = L*cos(theta); 47 48 n1 =ceil(A^2*2+0.5);% the first 3 sidelobes have almost same amplitude 49 % n1 =4; 50 %I=taylorwin(N,n1,SLL); 51 sigma = n1/sqrt(A^2+(n1-0.5)^2); 52 xn = zeros(1,n1-1); 53 for j = 1:1:n1-1 54 xn(j) = sigma*sqrt(A^2+(j-0.5)^2); 55 % xn(j) = j*sqrt(A^2+(j-0.5).^2)/sqrt(A^2+(n1-0.5).^2); 56 end 57 for i = 1:1:length(x) 58 if x(i) ~= 0 59 T(i) = sin(pi*x(i))/pi/x(i)*cosh(pi*A); 60 for j = 1:1:n1-1 61 T(i) = T(i)*(1-(x(i)/xn(j))^2)/(1-(x(i)/j)^2); 62 end 63 else 64 T(i) = cosh(pi*A); 65 for j = 1:1:n1-1 66 T(i) = T(i)*(1-(x(i)/xn(j))^2)/(1-(x(i)/j)^2); 67 end 68 end 69 end 70 T = T / max(T); 71 72 I =ones(1,N); 73 % zn = zeros(1,N); 74 for i = 1:1:N 75 if mod(N,2) == 1 76 zn = abs((i-(N+1)/2)*d*2/L); 77 else 78 %#zn = (i-(N+1)/2)*d 79 if i < (N+1)/2 80 zn = (2*abs((N/2+1)-i)-1)*d/L; 81 else 82 zn = (2*abs(i-N/2)-1)*d/L; 83 end 84 end 85 for j = 1:1:n1-1 86 % I(i) = I(i) + 2*T((find( min(abs(x-j))==abs(x-j))))*cos(j*pi*zn); 87 tmp = power(prod(1:(n1-1)),2)/prod(1:(n1-1+j))/prod(1:(n1-1-j)); 88 for k = 1:1:n1-1 89 tmp = tmp* (1-j^2/sigma^2/(A^2+(k-0.5)^2)); 90 end 91 92 I(i) = I(i) + 2*tmp*cos(j*pi*zn); 93 end 94 end 95 I = I/max(I); 96 97 end
对于N=10,SLL=-30,综合结果如下: