Having some trouble getting this piece of code to work. Basically I'm running a for loop at the end of a long script, and I want it to plot a new figure at each iteration of the loop.
All variables have previously been declared, the loop however is only running one iteration and plotting the first figure only.
Any ideas would be much appreciated!
for m = 1:length(p1)
for n = 1:length(p2)
pw = reshape(20*log10(real(p_wem(m,n,:))/2e-5),length(kR),1);
pa = reshape(20*log10(real(p_analytical(m,n,:))/2e-5),length(kR),1);
figure
plot(kR,pw)
hold on
plot(kR,pa,'r')
drawnow
xlabel('kR')
ylabel('SPL (dB)')
legend('WEM','Analytical','Location','EastOutside')
title(['Receiver ',int2str(n),' of MD Ring ',int2str(m)])
end
end
W/ what's shown one must presume length(p1)==length(p2)=1
--