Hi COMM, How can I hold only one plot while updating the rest in a figure ? E.g. I want to keep (x,f) plot fixed , while keeping the current value for the animated plot

조회 수: 2 (최근 30일)
SSmin=0;
SSmax=19;
x=SSmin:0.01:SSmax;
f= (x).*sin(x) +20;
figure
plot(x,f)
hold on
for k=1:length(x)
plot(x(k),f(k),'or')
axis([SSmin SSmax 0 30])
pause(0.2)
end

답변 (1개)

VBBV
VBBV 2022년 1월 20일
편집: VBBV 2022년 1월 20일
for k=1:length(x)
plot(x(1:k),f(1:k),'or')
axis([SSmin SSmax 0 30])
pause(2)
end
Check with this
  댓글 수: 2
Mahmud Hamed
Mahmud Hamed 2022년 1월 20일
편집: Mahmud Hamed 2022년 1월 20일
This is not working VBBV, Its just delaying the pause time
VBBV
VBBV 2022년 1월 20일
편집: VBBV 2022년 1월 20일
h = animatedline('MaximumPoints',length(x),'Marker','or')
for k=1:length(x)
addpoints(h,x(k),f(k))
axis([SSmin SSmax 0 35])
drawnow
end
you can use drawnow to animate the line. Check also animate page for more information how to animate

댓글을 달려면 로그인하십시오.

카테고리

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