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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
vijaya lakshmi
2018-3-19
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!