Graphics Programs Reference
In-Depth Information
% choose proper size fft, for minimum value choose 256X256
Nrx = 10 * Nx;
Nry = 10 * Ny;
nfftx = 2^(ceil(log(Nrx)/log(2)));
nffty = 2^(ceil(log(Nry)/log(2)));
if nfftx < 256
nfftx = 256;
end
if nffty < 256
nffty = 256;
end
% generate array of elements with or without window
if winid < 0
array = ones(Nxr,Nyr);
else
array = win;
end
% convert steering angles (theta0, phi0) to radians
theta0 = theta0 * pi / 180;
phi0 = phi0 * pi / 180;
% convert steering angles (theta0, phi0) to U-V sine-space
u0 = sin(theta0) * cos(phi0);
v0 = sin(theta0) * sin(phi0);
% Use formula thetal = (2*pi*n*dol) * sin(theta0) divided into 2^m levels
% and rounded to the nearest qunatization level
if nbits < 0
phasem = exp(i*2*pi*dolx*u0 .* nx *ratiox);
phasen = exp(i*2*pi*doly*v0 .* ny *ratioy);
else
levels = 2^nbits;
qlevels = 2.0*pi / levels; % compute quantization levels
sinthetaq = round(dolx .* nx * u0 * levels * ratiox) .* qlevels; % vector of
possible angles
sinphiq = round(doly .* ny * v0 * levels *ratioy) .* qlevels; % vector of pos-
sible angles
phasem = exp(i*sinthetaq);
phasen = exp(i*sinphiq);
end
% add the phase shift terms
array = array .* (transpose(phasem) * phasen);
% determine if interpolation is needed (i.e., N > Nr)
if (Nx > Nxr )| (Ny > Nyr)
for xloop = 1 : Nxr
temprow = array(xloop, :) ;
Search WWH ::




Custom Search