Диаграммы направленности антенн (часть 3)
Автор
Соавторы
function TaylorSpectrumWindow(N, nbar = 4, sll = 30)
function calcFm(m, sp2, A, NBAR)
n = Array(1:NBAR-1)
p = [Array(1:m-1); Array((m+1):(NBAR-1))]
Num = prod((1 .- (m^2/sp2)./(A^2 .+(n .-0.5).^2)));
Den = prod((1 .- m.^2 ./p.^2));
return ((-1)^(m+1).*Num)./(2 .*Den)
end
A = acosh((10^(sll/20)))/π
sp2 = nbar^2 / (A^2 + (nbar - 0.5)^2)
Fm = zeros(nbar - 1)
sum = zeros(N)
k = Array(0:N-1)
xi = @. (k-0.5*N+0.5)/N
for m = 1:(nbar-1)
Fm[m] = calcFm(m,sp2,A,nbar);
@. sum = Fm[m]*cos(2*pi*m*xi)+sum;
end
@. sum = 2sum + 1
return sum
end
function plot_pattern2_arrray(Array1,Array2,c,f,comment)
out_pattern = pattern(
Array1,f,collect((-90:1:90)),0,
PropagationSpeed = c,out = :data
)
out_pattern_2 = pattern(
Array2,f,collect((-90:1:90)),0,
PropagationSpeed = c,out = :data
)
azim_vec = out_pattern_2[2][:]
not_tapper_resp = out_pattern[1][:].-maximum(out_pattern[1])
tapper_resp = out_pattern_2[1][:].-maximum(out_pattern_2[1])
plot(azim_vec,not_tapper_resp,lw=2,
ylims=(-100,10),yticks=(-100:10:10),
label=comment[1],color="blue",
title="Диаграмма направленности ФАР",
ylabel="Амплитуда, дБ",
xlabel="Угол, град"
)
plot!(azim_vec,tapper_resp,lw=2,
label=comment[2],ls = :dashdot,color="red"
)
end
function taylortaperc(pos::Array{<:Real},D::Real,nbar::Real = 4,sll::Real = -30,posc::Array{<:Real} = mean(pos,dims = 2))
nbar <= 10 || throw(ArgumentError("Expected NBAR to be a scalar with value <= 10."))
sll < 0 || throw(ArgumentError("Expected SLL to be a scalar with value < 0."))
size(posc, 2) == 1 || throw(ArgumentError("Expected POSC to be a column vector."))
if size(pos,1) == 2
p = hypot.(pos[1,:] .- posc[1,:], pos[2,:] .- posc[2,:])'./D
else
p = hypot.(hypot.(pos[1,:] .- posc[1,:], pos[2,:] .- posc[2,:]), pos[3,:] .- posc[3,:])'./D
end
any(p .> 0.5) && throw(ArgumentError("Elements positions must be within the array aperture."))
n = collect((1:nbar-1)')
A = acosh(10^(-sll/20))/pi
sigma = besselj1zeros.(nbar)/sqrt(A^2+(nbar-1/2)^2)
zn = sigma .* sqrt.(A^2 .+ (n .- 1/2).^2)
un = besselj1zeros.(n)
F_num = prod(1 .- un.^2 ./ zn[:].^2, dims=1)'
temp = 1 .- broadcast(./, un.^2, un[:].^2)
temp[begin:nbar:end] .= 1
F_dec = prod(temp,dims=1)'
F = [1 collect((-besselj.(0,pi*un)'.*F_num./F_dec)')]
xi = transpose(2*p[:])
un = besselj1zeros.([0 n])
return 2/(pi^2) .* sum(broadcast(./,F[:] .* besselj.(0,pi*un[:]*xi), besselj.(0,pi*un)' .^ 2), dims = 1)'
end
function besselj1zeros(n)
uparam = [0 1.2196699 2.2331306 3.2383154 4.2410628 5.2427643 6.2439216 7.2447598 8.2453948 9.2458927 10.2462933]
return uparam[n .+ 1]
end
function ind2sub(siz,ndx,nout)
typeof(siz) <: Tuple && (siz = collect(siz)')
varargout = []
if length(siz) < nout
siz = [siz ones(1,nout-length(siz))]
elseif length(siz) > nout
siz = [siz[1:nout-1] prod(siz[nout:end])]
end
if nout > 2
k = cumprod(siz;dims=2)
for i = nout:-1:3
vi = rem.(ndx.-1, k[i-1]) .+ 1
vj = Integer.((ndx .- vi)/k[i-1] .+ 1)
pushfirst!(varargout, vj)
ndx = vi
end
end
if nout >= 2
vi = rem.(ndx.-1, siz[1]) .+ 1
v2 = (ndx .- vi)/siz[1] .+ 1
v1 = vi
else
v1 = ndx
end
return Integer.(hcat(v1,v2,varargout...))
end
function calcElemetPosition(Array)
# ----------------Распаковка системного объекта----------------------
array_sz= Array.Size
Idx_el = Vector(1:prod(array_sz))
elementSpacing = Array.ElementSpacing # расстояние между элементами
lattice = Array.Lattice # конфигурация АР
type_norm= Array.ArrayNormal # ориентация антенной решетки
NPerRow = array_sz[2] # количество элементов по горизонтали
NPerCol = array_sz[1] # количество элементов по вертикали
deltaRows = (NPerRow-1)/2+1 # приращение по строкам
deltaCols = (NPerCol-1)/2+1 # приращение по столбцам
out_idx = ind2sub(array_sz,Idx_el,2) # переход к матричной индексации
IdxInCol,IdxInRow = out_idx[:,1],out_idx[:,2]
#-----------------------------------------------------------------------------------
pos2 = (IdxInRow .- deltaRows)*elementSpacing[2]
if lattice== "Triangular"
evenrowidx = .!Bool.(rem.(IdxInCol,2))
pos2[evenrowidx] .= pos2[evenrowidx] .+ elementSpacing[2]/2
end
pos3 = (deltaCols .- IdxInCol)*elementSpacing[1]
pos = zeros(3,length(Idx_el))
if type_norm == "x"
pos[2,:] .= pos2
pos[3,:] .= pos3
elseif type_norm == "y"
pos[1,:] .= -pos2
pos[3,:] .= pos3
else
pos[1,:] .= pos2
pos[2,:] .= pos3
end
return pos
end
function viewURA(pos;is_failed=false,weight=[1,1])
if is_failed
idx_norm = findall(weight[:] .== 1)
idx_failed = findall(weight[:] .== 0)
end
image = if is_failed
scatter3d(pos[1,idx_norm],pos[2,idx_norm],pos[3,idx_norm];label="",axis=false)
scatter3d!(pos[1,idx_failed],pos[2,idx_failed],pos[3,idx_failed];label="",axis=false,color="black")
else
scatter3d(pos[1,:],pos[2,:],pos[3,:];label="",axis=false)
end
return image
end