数组索引必须为正整数或逻辑值。

82 次查看(过去 30 天)
祥贺
祥贺 2023-10-18
%% LFM 脉冲多普勒雷达
%==================================================================
function LFM_radar(T,B,Rmin,Rmax,R,RCS)
if nargin==0
T=100e-6; %脉冲宽度100us
B=10e9; %频带宽度1GHz
Rmin=1000;Rmax=2000; %测距范围
R=[1050,1200,1500,1550,1800,1802]; %目标点的位置,每一个目标相对于雷达的斜距
RCS=[1 1 1 1 1 1]; %雷达截面积,一维数组
end
%====================================
%%
C=3e8; %光速
K=B/T; %调频斜率
Rwid=Rmax-Rmin; %最大测距长度
Twid=2*Rwid/C; %回波窗的长度
Fs=5*B;Ts=1/Fs; %采样频率与采样时间
Nwid=ceil(Twid/Ts); %采样窗内的采样点数
%==================================================================
%%产生回波
t=linspace(2*Rmin/C,2*Rmax/C,Nwid); %回波窗
%open window when t=2*Rmin/C
%close window when t=2*Rmax/C
M=length(R); %目标的个数
td=ones(M,1)*t-2*R'/C*ones(1,Nwid);
Srt=RCS*(exp(1j*pi*K*td.^2).*(abs(td)<T/2));%从点目标来的回波
%==================================================================
%%数字信号处理 脉冲压缩
Nchirp=ceil(T/Ts); %脉冲宽度离散化
Nfft=2^nextpow2(Nwid+Nwid-1); %方便使用FFT算法,满足2的次方形式
Srw=fft(Srt,Nfft); %回波做FFT
t0=linspace(-T/2,T/2,Nchirp);
St=exp(1j*pi*K*t0.^2); %线性调频信号原始信号作为参考信号
% %%加窗处理
% win=blackman(Nwid)';
% St_w=St.*win';
% %%
Sw=fft(St,Nfft); %参考信号做FFT
Sot=fftshift(ifft(Srw.*conj(Sw))); %脉冲压缩后的信号
%==================================================================
N0=Nfft/2-Nchirp/2;
Z = abs(Sot(floor(N0) : floor(N0 + Nwid - 1)));
Z=Z/max(Z);
Z=20*log10(Z+1e-6);
%figure
subplot(211)
plot(t*1e6,real(Srt));axis tight;
xlabel('Time/us');ylabel('幅度')
title('雷达回波没经过脉冲压缩');
subplot(212)
plot(t*C/2,Z)
axis([1000,1500,-60,0]);
xlabel('距离/m');ylabel('幅值/dB')
title('雷达回波经过脉冲压缩');
出现问题:数组索引必须为正整数或逻辑值。
出错 zuoye2 (第 43 行)
Z = abs(Sot(floor(N0) : floor(N0 + Nwid - 1)));
我的雷达参数是固定的,怎样修改算法或者语句能够解决问题?
  1 个评论
Walter Roberson
Walter Roberson 2023-10-18
Approximate translation:
Array index must be a positive integer or logical value.Error zuoye2 (line 43) Z = abs(Sot(floor(N0) : floor(N0 + Nwid - 1)));
My radar parameters are fixed. How can I modify the algorithm or statements to solve the problem?

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2023-10-18
T=100e-6; %脉冲宽度100us
B=10e9; %频带宽度1GHz
Fs=5*B;Ts=1/Fs; %采样频率与采样时间
So Ts will be on the order of 2e-11
Nchirp=ceil(T/Ts); %脉冲宽度离散化
T is 1e-4 and you divide it by 2e-11 getting about 5e6
Nfft=2^nextpow2(Nwid+Nwid-1); %方便使用FFT算法,满足2的次方形式
That comes out as 1048576 (I am not going to go through all of the steps to show the calculation in detail.)
N0=Nfft/2-Nchirp/2;
1048576/2 is a lot less than 5e6/2 so the subtraction gives a negative number.
Z = abs(Sot(floor(N0) : floor(N0 + Nwid - 1)));
which you then try to use as an index to vector Sot

更多回答(1 个)

Image Analyst
Image Analyst 2023-10-18

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by