Read a matrix between elements
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Miguel Albuquerque
el 5 de Jul. de 2022
Comentada: Miguel Albuquerque
el 5 de Jul. de 2022
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 comentarios
dpb
el 5 de Jul. de 2022
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...
Respuesta aceptada
dpb
el 5 de Jul. de 2022
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
0 comentarios
Más respuestas (1)
Sulaymon Eshkabilov
el 5 de Jul. de 2022
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
0 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!