Borrar filtros
Borrar filtros

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 visualización (últimos 30 días)
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

Respuestas (1)

vijaya lakshmi
vijaya lakshmi el 19 de Mzo. de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by