フィルターのクリア

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

3 ビュー (過去 30 日間)
ravi shukla
ravi shukla 2023 年 4 月 26 日
編集済み: chicken vector 2023 年 4 月 26 日
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 Center および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by