Read a matrix between elements

2 ビュー (過去 30 日間)
Miguel Albuquerque
Miguel Albuquerque 2022 年 7 月 5 日
Hey Guys, I need to read two variables, that have a large amount of samples(30 million values).
I need to select a thousand values from that two variables, correlate them and produce a plot. Then I want to do this again, with new thousand samples, produce a new plot, and so on, till the end of the 30 million values.
I have this code:
So in the first iteration I want Reference_signal_samples(1:1000) and Surveillance_signal_samples(1:1000), do the code
[afmag3,delay3,doppler3], see the plot after the for loop and save it. Next iteration I want Reference_signal_samples(4000:5000) and Surveillance_signal_samples(4000:5000), do the code
[afmag3,delay3,doppler3], see the plot after the for loop and save it. Between iteration I want a step of 3000 samples.
How can i do this in my code, I ve been trying but I cant achieve it
pulse_size = 1000;
%nRef = numel(Reference_signal)/Fs;
%nSurv = numel(Surveillance_signal)/Fs;
nRef = numel(Reference_signal)/pulse_size;
nSurv = numel(Surveillance_signal)/pulse_size;
for k = 1:nRef
Reference_signal_samples =Reference_signal((k-1)*pulse_size+(1:pulse_size));
for kk =1:nSurv
Surveillance_signal_samples=Surveillance_signal((kk-1)*pulse_size+(1:pulse_size));
[afmag3,delay3,doppler3] = ambgfun(Reference_signal_samples,Surveillance_signal_samples,Fs,[250000 250000]);
afmag3(afmag3>1 )= 1;
end
end
figure;
surf(delay3,doppler3,afmag3,'LineStyle','-.');
shading interp;
axis([-1e-5 1e-5 -2000 2000]);
grid on;
view([140,35]);
colorbar;
ylabel('Doppler (Hz)');
xlabel('Delay(s)');
title('Ambiguity Function Sref');
  5 件のコメント
dpb
dpb 2022 年 7 月 5 日
OK, I missed the 3000 step interval -- that's a big improvement although 1,000 is still stretching the limits of human endurance and likelihood of really catching anything...
Miguel Albuquerque
Miguel Albuquerque 2022 年 7 月 5 日
yep, life ain't easy pal

サインインしてコメントする。

採用された回答

dpb
dpb 2022 年 7 月 5 日
I'd go at it something like
N=1000;
D=3000;
for i1=1:D:size(x,1) % starting index each subsection
i2=i1+N-1; % ending index each subsection
% process here
result=yourAnalysis(x(i1:i2)); % do your thing with this subset
end

その他の回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022 年 7 月 5 日
One of the possible solutions can be using cell array to define the indices, something like this way:
INDEX = {1:1000, 4000:5000, ...}
for ii = 1:10
for jj = INDEX(ii)
...
end
end

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by