Plot functions in a for cycle
Afficher commentaires plus anciens
Hey guys, thanks in advance,
I have this code , that calculates ambiguity function for signals with a lot of values. On each iteration, I want to plot the graphic with the code below ( cross-correlation). Is there a better way, than for each iteration, interrupt for loop to see the plot?
for k = 1 : 500000 : length(Reference_signal)
for kk = 1: 500000 : length(Surveillance_signal)
Reference_signal_samples = Reference_signal(k : k + 499999);
Surveillance_signal_samples= Surveillance_signal(kk : kk + 499999)
[afmag3,delay3] = ambgfun(Reference_signal_samples,Surveillance_signal_samples,Fs,[250000 250000],'cut','Doppler');
afmag3 = afmag3*1; % Select plot gain *1
afmag3(afmag3>1 )= 1;
end
end
% Plot cross-correlation
[pks3,index3] = max(afmag3);
xMax3 = delay3(index3);
yMax3 = pks3;
subplot(3,2,3)
plot(delay3,afmag3,'LineStyle','-');
hold on
%plot3(delay3(pks3,index3), afmag3(pks3,index3), pks3, '^r');
textString3 = sprintf('(%f, %f)', xMax3, yMax3);
text(xMax3, yMax3,textString3,"Color",'b','FontSize',10);
hold off
shading interp;
%xlim([-0.5e-5 16e-5]);
xlim auto;
grid on;
colorbar;
xlabel('Delay \tau (s)');
ylabel('Ambiguity Function Magnitude');
title('Cross-correlation');
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Pulsed Waveforms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
