Read a matrix between elements

조회 수: 1 (최근 30일)
Miguel Albuquerque
Miguel Albuquerque 2022년 7월 5일
댓글: 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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by