clc
clear
close all
参数设置
距离向参数设置
R_eta_c = 20e3; % 景中心斜距
Tr = 2.5e-6; % 发射脉冲时宽
Kr = 20e12; % 距离向调频率
alpha_os_r = 1.7; % 距离过采样率
Nrg = 320; % 距离线采样数
距离向参数计算
Bw = abs(Kr)*Tr; % 距离信号带宽
Fr = alpha_os_r*Bw; % 距离向采样率
Nr = round(Fr*Tr); % 距离采样点数(脉冲序列长度)
方位向参数设置
c = 3e8; % 光速
Vr = 150; % 等效雷达速度
Vs = Vr; % 卫星平台速度
Vg = Vr; % 波束扫描速度
f0 = 5.3e9; % 雷达工作频率
Delta_f_dop = 80; % 多普勒带宽
alpha_os_a = 1.7; % 方位过采样率
Naz = 256; % 距离线数
theta_r_c = 3.5; % 波束斜视角
方位向参数计算
lambda = c/f0; % 雷达工作波长
eta_c = -R_eta_c*sind(theta_r_c)/Vr;
% 波束中心偏移时间
f_eta_c = 2*Vr*sind(theta_r_c)/lambda;
% 多普勒中心频率
La = 0.886*2*Vs*cosd(theta_r_c)/Delta_f_dop;
% 实际天线长度
Fa = alpha_os_a*Delta_f_dop;% 方位向采样率
Ta = 0.886*lambda*R_eta_c/(La*Vg*cosd(theta_r_c));
% 目标照射时间
R0 = R_eta_c*cosd(theta_r_c);
% 最短斜距
Ka = 2*Vr^2*cosd(theta_r_c)^3/(lambda*R0);
% 方位向调频率
theta_bw = 0.886*lambda/La; % 方位向3dB波束宽度
theta_syn = Vs/Vg*theta_bw; % 合成角
Ls = R_eta_c*theta_syn; % 合成孔径
其他参数计算
rho_r = c/2/Bw; % 距离向分辨率
rho_a = La/2; % 方位向分辨率
Trg = Nrg/Fr; % 发射脉冲宽度
Taz = Naz/Fa; % 目标照射时间
d_t_tau = 1/Fr; % 距离向采样时间间隔
d_t_eta = 1/Fa; % 方位向采样时间间隔
d_f_tau = Fr/Nrg; % 距离向采样频率间隔
d_f_eta = Fa/Naz; % 方位向采样频率间隔
目标设置
设置目标点距离景中心的距离
A_r = -50;A_a = -50;
B_r = -50;B_a = +50;
C_r = +50;C_a = B_a+(C_r-B_r)*tand(theta_r_c);
坐标
A_x = R0+A_r;A_y = A_a;
B_x = R0+B_r;B_y = B_a;
C_x = R0+C_r;C_y = C_a;
N_position = [A_x,A_y;B_x,B_y;C_x,C_y];
波束中心穿越时刻
N_target = 3;
Target_eta_c = zeros(1,N_target);
for i = 1:N_target
Delta_Y = N_position(i,2)-N_position(i,1)*tand(theta_r_c);
Target_eta_c(i) = Delta_Y/Vs;
end
绝对零多普勒时刻
Target_eta_0 = zeros(1,N_target);
for i = 1:N_target
Target_eta_0(i) = N_position(i,2)/Vs;
end
变量设置
时间变量:以景中心绝对零多普勒时刻作为方位向零点
t_tau = (-Trg/2:d_t_tau:Trg/2-d_t_tau)+2*R_eta_c/c; % 距离时间变量
t_eta = (-Taz/2:d_t_eta:Taz/2-d_t_eta)+eta_c; % 方位时间变量
r_tau = (t_tau*c/2)*cosd(theta_r_c); % 最近距离变量
频率变量
f_tau = fftshift(-Fr/2:d_f_tau:Fr/2-d_f_tau); % 距离频率变量
f_tau = f_tau-round((f_tau-0)/Fr)*Fr; % 将频率折叠入(-Fr/2,Fr/2),距离可观测频率变量
f_eta = fftshift(-Fa/2:d_f_eta:Fa/2-d_f_eta); % 方位频率变量
f_eta = f_eta-round((f_eta-f_eta_c)/Fa)*Fa; % 将频率折叠入f_eta_c附近(-Fa/2,Fa/2)范围,方位可观测频率变量
坐标设置
[t_tauX,t_etaY] = meshgrid(t_tau,t_eta); % 距离时间X轴,方位时间Y轴
[f_tauX,f_etaY] = meshgrid(f_tau,f_eta); % 距离频域X轴,方位频域Y轴
[r_tauX,f_eta_Y] = meshgrid(r_tau,f_eta); % 距离长度X轴,方位频域Y轴
信号设置,原始回波生成
tic % 计时,与toc搭配使用
wait_title = waitbar(0,'开始生成回波数据 ...');
pause(1);
st_tt = zeros(Naz,Nrg);
for i = 1:N_target
R_eta = sqrt(N_position(i,1)^2+Vs^2*(t_etaY-Target_eta_0(i)).^2);
% 瞬时斜距,还有近似公式可以尝试
A0 = [1,1,1,1]*exp(+1j*0); % 后向散射系数
wr = (abs(t_tauX-2*R_eta/c)<=Tr/2); % 距离向包络
wa = sinc(0.886*atan(Vs*(t_etaY-Target_eta_c(i))/N_position(i,1))/theta_bw).^2;
% 方位向包络,用波束穿越时刻
% wa = sinc(0.886*(atan(Vs*(t_etaY-Target_eta_0(i))/N_position(i,1))+theta_r_c)/theta_bw).^2;
st_tt_target = A0(i)*wr.*wa.*exp(-1j*4*pi*f0*R_eta/c)...
.*exp(1j*pi*Kr*(t_tauX-2*R_eta/c).^2);
st_tt = st_tt+st_tt_target;
pause(0.001);
time = toc;
Display_Data = num2str(roundn(i/N_target*100,-1));
Display_Str = ['Computation Progress',Display_Data,'%',' --- ',...
'Using Time: ',num2str(time)];
waitbar(i/N_target,wait_title,Display_Str); % 三参数:进度,句柄,展示的话
end
pause(1);
close(wait_title);
toc
% figure('Name','原始数据回波'),subplot(221)
% imagesc(real(st_tt))
% xlabel('距离时间(采样点)'),ylabel('方位时间(采样点)'),title('(a)实部')
% subplot(222)
% imagesc(imag(st_tt))
% xlabel('距离时间(采样点)'),ylabel('方位时间(采样点)'),title('(b)虚部')
% subplot(223)
% imagesc(abs(st_tt))
% xlabel('距离时间(采样点)'),ylabel('方位时间(采样点)'),title('(c)幅度')
% subplot(224)
% imagesc(angle(st_tt))
% xlabel('距离时间(采样点)'),ylabel('方位时间(采样点)'),title('(d)相位')
一次距离压缩
方式三:根据脉冲频谱特性直接在频域生成频域匹配滤波器
window = kaiser(Nrg,2.5)'; % 时域窗
Window = fftshift(window); % 频域窗
% figure,plot(window)
% figure,plot(Window)
Hrf = (abs(f_tauX)<=Bw/2).*Window.*exp(1j*pi*f_tauX.^2/Kr);
Sf_ft = fft(st_tt,Nrg,2);
Srf_tf = Sf_ft.*Hrf;
srt_tt = ifft(Srf_tf,Nrg,2);
% figure('Name','一次距离压缩'),subplot(121)
% imagesc(real(srt_tt))
% xlabel('距离时间(采样点)'),ylabel('方位时间(采样点)'),title('(a)实部')
% subplot(122)
% imagesc(abs(srt_tt))
% xlabel('距离时间(采样点)'),ylabel('方位时间(采样点)'),title('(b)虚部')
方位向FFT
Saf_tf = fft(srt_tt,Naz,1);
% figure('Name','方位FFT'),subplot(121)
% imagesc(real(Saf_tf)),set(gca,'YDir','normal')
% xlabel('距离时间(采样点)'),ylabel('方位时间(采样点)'),title('(a)实部')
% subplot(122)
% imagesc(abs(Saf_tf)),set(gca,'YDir','normal')
% xlabel('距离时间(采样点)'),ylabel('方位时间(采样点)'),title('(b)幅度')
距离徙动校正——8点插值
RCM = lambda^2*r_tauX.*f_etaY.^2/(8*Vr^2);
RCM = R0+RCM-R_eta_c; % 将距离徙动量转换到原图坐标系下
offset = RCM/rho_r; % 将距离徙动量转换为距离单元偏移量
计算插值表
x_tmp = repmat(-4:3,[16,1]); % 插值长度
x_tmp = x_tmp+repmat(((1:16)/16).',[1,8]); % 量化位移
% figure,imagesc(repmat(((1:16)/16)',[1,8])),colorbar
% figure,imagesc(repmat(-4:3,[16,1])),colorbar
% figure,imagesc(repmat(((1:16)/16)',[1,8])+repmat(-4:3,[16,1])),colorbar
hx = sinc(x_tmp); % 生成插值核
% % figure,imagesc(hx)
hx = kaiser(8,2.5)'.*hx;
hx = hx./sum(hx,2); % 归一化
插值表校正
tic
wait_title = waitbar(0,'开始进行距离徙动校正');
pause(1)
Srcmf_tf_8 = zeros(Naz,Nrg);
for a_tmp = 1:Naz
for r_tmp = 1:Nrg
offset_ceil = ceil(offset(a_tmp,r_tmp));
offset_frac = round((offset_ceil-offset(a_tmp,r_tmp))*16);
if offset_frac == 0
Srcmf_tf_8(a_tmp,r_tmp) = Saf_tf(a_tmp,ceil(mod(r_tmp+offset_ceil-0.1,Nrg)));
else
Srcmf_tf_8(a_tmp,r_tmp) = Saf_tf(a_tmp,ceil(mod((r_tmp+offset_ceil-4:r_tmp+offset_ceil+3)-0.1,Nrg)))*hx(offset_frac,:).';
end
end
pause(0.001)
time = toc;
Display_Data = num2str(roundn(a_tmp/Naz*100,-1));
Display_Str = ['Computation Progress ',Display_Data,'%',' --- ',...
'Using Time: ',num2str(time)];
waitbar(a_tmp/Naz,wait_title,Display_Str)
end
pause(1)
close(wait_title)
toc
% figure('Name','8点距离徙动校正'),subplot(121)
% imagesc(real(Srcmf_tf_8)),set(gca,'YDir','normal')
% xlabel('距离时间(采样点)'),ylabel('方位频率(采样点)'),title('(a)实部')
% subplot(122)
% imagesc(abs(Srcmf_tf_8)),set(gca,'YDir','normal')
% xlabel('距离时间(采样点)'),ylabel('方位频率(采样点)'),title('(b)幅度')
方位压缩
Ka = 2*Vr^2*cosd(theta_r_c)^3./(lambda*r_tauX);
Haf = exp(-1j*pi*f_etaY.^2./Ka); % 匹配滤波器
Haf_offset = exp(-1j*2*pi*f_etaY*eta_c); % 时间补偿项
Soutf_tf = Srcmf_tf_8.*Haf.*Haf_offset;
soutt_tt = ifft(Soutf_tf,Naz,1);
% save('D:\BaiduSyncdisk\博士\合成孔径雷达成像算法实现与仿真\soutt_tt','soutt_tt')
绘图
H1 = figure();
set(H1,'position',[100,100,600,300]);
subplot(121),imagesc(real(soutt_tt))
xlabel('距离时间(采样点)→'),ylabel('←方位时间(采样点)'),title('(a)实部')
subplot(122),imagesc( abs(soutt_tt))
xlabel('距离时间(采样点)→'),ylabel('←方位时间(采样点)'),title('(b)幅度')
点目标分析
% figure,imagesc(abs(fftshift(fft2(soutt_tt))))
[row,col] = size(soutt_tt);
Sout = fftshift(fft2(soutt_tt));
figure,imagesc(abs(Sout))
% Sout_buling = zeros(16*row,16*col);
% Sout_buling(8*row+1:9*row,8*col+1:9*col) = Sout;
Sout_buling = upsample(soutt_tt,16);
figure,imagesc(abs(Sout_buling))
% sout_1 = ifft(Sout_buling,[],2);
% sout_2 = ifft(Sout_buling,[],1);
% figure,imagesc(abs(fftshift(sout_2)))
sout_3 = ifft2(Sout_buling);
figure,imagesc(abs(sout_3))
len = 16*16;
cut = -len/2:len/2-1;
start_tt = sout_3(2772+cut,3013+cut);
figure,imagesc(abs(start_tt))
figure('Name','1'),contour(abs(start_tt),15)
len = 32;
cut = -len/2:len/2-1;
start_tt = soutt_tt(round(Naz/2+1+N_position(3,2)/Vr*Fa)+cut, ...
round(Nrg/2+1+2*(N_position(3,1)-R0)/c*Fr)+cut);
% start_tt = soutt_tt(169+cut, ...
% 182+cut);
figure
imagesc(abs(start_tt))
Start_ff = fft2(start_tt);
figure
imagesc(abs(Start_ff)),set(gca,'YDir','normal')
figure
imagesc(abs(fftshift(Start_ff))),set(gca,'YDir','normal')
% Start = zeros(5*16,5*16);
% Start(2*16+1:3*16,2*16+1:3*16) = Start_ff;
% figure
% imagesc(abs(Start))
% start = ifft2(ifftshift(Start));
% contour(abs(start),15)
% figure
% imagesc(abs(start))
len = 16;
cut = -len/2:len/2-1;
[aa,p] = max(abs(start_tt));
[bb,q] = max(max(abs(start_tt)));
start_tt_1 = start_tt(p(q)+cut,q+cut);
figure,imagesc(abs(start_tt_1))
Start_ff_1 = fft2(start_tt_1);
figure,imagesc(abs(Start_ff_1)),set(gca,'YDir','normal')
figure,imagesc(abs(fftshift(Start_ff_1))),set(gca,'YDir','normal')
% 高频补零
Start_buling_1 = zeros(len,16*len);
Start_buling_2 = zeros(16*len,16*len);
% 行补零
for i = 1:len
[~,I] = min(Start_ff_1(i,:));
Start_buling_1(i,1:I) = Start_ff_1(i,1:I);
Start_buling_1(i,16*len-(len-I)+1:16*len) = Start_ff_1(i,I+1:end);
end
% 列补零
for i = 1:16*len
[~,I] = min(Start_buling_1(:,i));
Start_buling_2(1:I,i) = Start_buling_1(1:I,i);
Start_buling_2(16*len-(len-I)+1:16*len,i) = Start_buling_1(I+1:end,i);
end
start_tf_1 = ifft(Start_buling_2,[],2);
start_tt_2 = ifft(start_tf_1,[],1);
figure('Name','高频补零'),imagesc(abs(start_tt_2))
contour(abs(start_tt_2),15)
Start_up = upsample(start_tt_1,16);
figure,imagesc(abs(Start_up))
figure,contour(abs(Start_up),15)