Hey guys, I have this code that correlates two signals with a large amount of samples, each one has 30 million. I want to save the max value of the correlation in a matrix or array, so that in the end of the cycle I can plot all the values and see the evolution of the max correlation.
I want to correlate all the surveillance_signal(30 million) with a small amount of samples of reference_signal(1000). Basically I will correlate these two signal thousand by thousand, spaced by thousand samples, till I reach the end of reference_signal.This means, first iteration:surveillance_signal(30 million) and reference_signal(1:1000), save the max correlation in a array. Second iteration surveillance_signal(30 million) and reference_signal(2000:3000), save the max correlation value.
I have this code, that does what I want, I think, but how can I save the maximum value(xMax3,yMax3) in each iteration so that in the end I can see the evolution in a plot.
reference_reshaped = reshape(Reference_signal, 1000, 4, []);
sz = size(reference_reshaped);
Surveillance_signal_samples=Surveillance_signal;
r = reference_reshaped(:,1,i);
[afmag3,doppler3] = ambgfun(r,Surveillance_signal_samples,Fs,[250000 250000],'Cut','Delay');
[pks3,index3] = max(afmag3);
xMax3 = doppler3(index3);
textString3 = sprintf('(%.2e, %f)', xMax3, yMax3);