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 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
vijaya lakshmi
on 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.
Hope this helps you.
0 Comments
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!