%% 合成孔径声纳成像仿真 单一阵元 收发合置 停走停
clear all; clc; close all;
%% %系统参数
c = 1500; %声速1500m/s;
pulseT = 10e-3; %发射信号脉宽10ms
f0 = 10e3; %发射信号中心频率20kHz
B = 6e3; %发射信号带宽8kHz
fs = 50e3; %系统采样率100kHz
d = 0.2; %系统实孔径0.2m
v = 0.1; %系统速度0.1m/s
Ts = 0.08; %系统采样时长0.08s;
T = 1; %系统采样周期1s
Y = 40; %方位向成像范围0-40m
tr1 = 30; %目标1距离向位置
ty1 = 20; %目标1方位向位置
tr2 = 35; %目标2距离向位置
ty2 = 19; %目标2方位向位置
tr3 = 35; %目标2距离向位置
ty3 = 20; %目标2方位向位置
lamda = c/f0; %信号波长
theta3dB = lamda/d; %系统3dB开角
sigT = 1/fs:1/fs:pulseT; %信号时间点
signal = chirp(sigT, f0-B/2,pulseT, f0+B/2); %发射信号
%===============================================================
% 仿真目标回波信号
num = floor(40/v/T); %总采样数据个数
recSigT = 1/fs:1/fs:Ts; %采样数据时间点
recSignals = zeros(num, length(recSigT));
recSignals1 = zeros(num, length(recSigT));
recSignals2 = zeros(num, length(recSigT));
recSignals3 = zeros(num, length(recSigT));
y11 = ty1-tr1*theta3dB/2; %声纳能够接受到目标回波信号的方位向范围
y12 = ty1+tr1*theta3dB/2;
----------------------------------------------------------------------------------
for i = 1:num
if i*v >= y11 && i*v <= y12
delay = sqrt(tr1^2+(ty1-i*v)^2)*2/c;
delayNum = round(delay*fs);
recSignals1(i,:) = [ zeros(1, delayNum), signal, zeros(1, length(recSigT)-delayNum-length(signal)) ];
end
end
---------------------------------------------------------------------------------------
y21 = ty2-tr2*theta3dB/2; %声纳能够接受到目标回波信号的方位向范围
y22 = ty2+tr2*theta3dB/2;
-----------------------------------------------------------------------------------------------
for i = 1:num
if i*v >= y21 && i*v <= y22
delay = sqrt(tr2^2+(ty2-i*v)^2)*2/c;
delayNum = round(delay*fs);
recSignals2(i,:) = [ zeros(1, delayNum), signal, zeros(1, length(recSigT)-delayNum-length(signal)) ];
end
end
-------------------------------------------------------------------------------------------------
y31 = ty3-tr3*theta3dB/2; %声纳能够接受到目标回波信号的方位向范围
y32 = ty3+tr3*theta3dB/2;
-------------------------------------------------------------------------------------------------
for i = 1:num
if i*v >= y31 && i*v <= y32
delay = sqrt(tr3^2+(ty3-i*v)^2)*2/c;
delayNum = round(delay*fs);
recSignals3(i,:) = [ zeros(1, delayNum), signal, zeros(1, length(recSigT)-delayNum-length(signal)) ];
end
end
% recSignals = recSignals1 + recSignals2 + recSignals3; recSignals = recSignals1;
----------------------------------------------------------------------------------------------
figure;
imagesc(recSignals);
---------------------------------------------------------------------
% 距离向匹配滤波
tempData = zeros(num, length(recSigT)*2-1);
dataR = zeros(num, length(recSigT));
---------------------------------------------------------------------------------------------------------
for i=1:num
tempData(i,:) = xcorr(recSignals(i,:), signal);
dataR(i,:) = (tempData(i,floor(length(tempData(i,:))/2+1):end));
end
----------------------------------------------------------------------------------------------------
figure;
imagesc(abs(dataR));
% 逐点成像
imgR = Ts*c/2; %距离向成像范围
imgY = Y; %方位向成像范围
resolution = 0.05; %成像分辨率0.1m
imgSizeX = floor(imgR/resolution);
imgSizeY = floor(imgY/resolution);
imgData = zeros(imgSizeY, imgSizeX);
-------------------------------------------------------------------------
for row = 1:imgSizeX
for col = 1:imgSizeY
posR = row*resolution;
posY = col*resolution;
sum = 0;
for i = 1:num
y1 = posY-posR*theta3dB/2; %声纳能够接受到目标回波信号的方位向范围
y2 = posY+posR*theta3dB/2;
if i*v < y1 || i*v > y2
continue;
end
delay = sqrt(posR^2+(posY-i*v)^2)*2/c;
if delay >= Ts
continue;
end
sum = sum + dataR(i, round(delay*fs));
end
imgData(col, row) = sum;
end
end
-------------------------------------------------------------
figure;
imagesc(imgData);
--------------------------------------------------------------
figure;
imagesc(abs(imgData));
------------------------------------------------------------------
figure;
surf(abs(imgData)); shading interp;
--------------------------------------------------------------------------