Plot two functions with different pause rates at same time.
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello,
I'm trying to plot these two sets of data that are different lengths, but cover the same amount of ground if that makes sense. The truncatedXYZ will plot a lot faster with timesteps(pauses) of around 0.01 whereas the jittercheck will plot slower with timesteps(pauses) of around 0.1. I'm trying to get it to plot the truncatedXYZ following that pause rate and plot the jittercheck following the other pause rate at the same time and on the same graph. When I do this, it only prints the first 239 points for truncatedXYZ instead of the full 2987 because the jittercheck has already finished all of its points. I commented out the pauses because they would make it take too long to check. The final result should be the same shape in red and black. Thank you for any tips or help you can give me.
frames = 239;
trunk = 2987;
hold on
ivals = 1:trunk;
jvals = 1:frames;
for K = 1 : length(ivals)
i = ivals(K);
j = jvals(K);
plot(truncatedXYZ.rel_x(i),truncatedXYZ.rel_y(i),'or')
xlim([7.4 8.6])
ylim([2.5 5])
%pause(truncatedXYZ.timestep(i))
plot(jittercheck(j,2),jittercheck(j,3),'ok')
xlim([7.4 8.6])
ylim([2.5 5])
%pause(jittercheck(j,6))
end
댓글 수: 0
채택된 답변
Mohammad Sami
2021년 9월 15일
편집: Mohammad Sami
2021년 9월 15일
You can try something like plotting j every few steps.
frames = 239;
trunk = 2987;
hold on
lastjplotted = 0;
for i = 1:trunk
j = ceil(i*frames/trunk);
plot(truncatedXYZ.rel_x(i),truncatedXYZ.rel_y(i),'or');
xlim([7.4 8.6]);
ylim([2.5 5]);
if(j > lastjplotted)
plot(jittercheck(j,2),jittercheck(j,3),'ok');
xlim([7.4 8.6]);
ylim([2.5 5]);
lastjplotted = j;
end
pause(truncatedXYZ.timestep(i));
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!