matbox.de / Matlab

You're currently not logged in. You cannot access to all files. Why?

go back to Matlab-archive...

Matlab - Far Field Viewer

This program visualizes the far field of a 1D-array of antennas.

download download

matlab screenshot

screenshot (click to enlarge)

Code (field calculation only)

%% Far field viewer for 2D-arrays of dipole antennas
% Rev 0.2, last update Feb 29th, 2012
%
% Copyright 2011 Torsten Reuschel
%                Hamburg University of Technology
%                E-Mail: matlab@matbox.de
% 
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
% 
%    http://www.apache.org/licenses/LICENSE-2.0
% 
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
    
function renew_field(handles)
    axes(handles.axes2);
    
    N = get(handles.sld_N,'Value');
    dx = get(handles.sld_dx,'Value');
     
    f = 30e3;       %frequency for reference purporses
    dp = -pi*get(handles.sld_dp,'Value');

    % prepare values
    lambda = 3e8/f;                 % wavelength
    k = 2*pi/lambda;                % wavenumber
    dx = dx*lambda;
    phis = linspace(0,2*pi,100*N);  % values for 360-degree field evaluation
    theta = pi/2;                   % consider x-y-plane only
    Dx = @(phi,theta)(0);

    % array factor
    D = @(idx,delta,phi,theta)(exp(1i*idx*delta*k.*cos(phi).*sin(theta)+1i*idx*dp));

    % add up antenna array
    for n = 0:N-1
        Dx = @(phi,theta)(Dx(phi,theta) + D(n,dx,phi,theta));
    end

    %move array to center of plot
    Dx = @(phi,theta)(Dx(phi,theta)*exp(-1i*(N)/2*dx));

    Dval = abs(Dx(phis,theta));
    % normalize array factor
    Dval = Dval/max(Dval);

    polar(phis, Dval);
    grid on;