필터 지우기
필터 지우기

I am using surf command inside time loop. And I want my initial reference surface.

조회 수: 3 (최근 30일)
I am using surf command inside time loop. And my initial surface is receiving some input. I want to update the surface but without loosing my initial reference surface.

답변 (1개)

chicken vector
chicken vector 2023년 4월 26일
편집: chicken vector 2023년 4월 26일
To plot multiple object you want to use:
hold on;
If you ant to iterate different plot but only retain the first one, the method is to assign the plot to a variable and delete it later in the same iteration or in the next one.
nPoints = 30;
nFrame = 100;
[X,Y] = meshgrid(-3:6/nPoints:3,-3:6/nPoints:3);
Z = peaks(X,Y);
coeff = -(1:1/nFrame:2);
figure;
set(gca,'XColor','None','YColor','None','ZColor','None');
hold on;
surf(X,Y,Z,'FaceAlpha',.3);
view([1,1.5,1.5])
xlim([-5,5])
ylim([-5,5])
zlim([-20,20])
for frame = 1 : nFrame
newSurf = surf(X,Y,Z*coeff(frame),'FaceColor',[.8 .8 .8],'EdgeColor','None','FaceAlpha',0.8);
pause(.05)
delete(newSurf)
end
hold off;
Result:

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by