Effacer les filtres
Effacer les filtres

HI, Following code generates 3 subplots for 3 different value of ik in 1 window , since the loop iterates ik= 1:3. I need to modify this peice of code to generate a single plot for variable Sum merging all three value of ik into one plot

1 vue (au cours des 30 derniers jours)
Sum=0;
for ik=1:3
Image = S(ik)*((abs(Phi(:,:,ik)).^2));
Sum= Sum+Image;
subplot(3,1,ik);
mesh(fftshift(X),fftshift(Y), fftshift(abs(Sum)),'FaceColor','flat'); view(0,90);
xlim([-2,2]); ylim([-2,2]);
axis square;
xlabel('f_x');
ylabel('f_y');
title(sprintf('Kernel %d Mag',ik));
end

Réponses (1)

vijaya lakshmi
vijaya lakshmi le 19 Mar 2018
Hi Sagar,
I understand that you want to create a single plot for variable Sum merging all values of ik instead of a subplot for each possible ik.
You can use the command 'hold on' and 'hold off' instead of 'subplot' which retains plots in the current axes so that new plots added to the axes do not delete existing plots.
Here is the documentation link for hold
Hope this helps you.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by