Plot two functions with different pause rates at same time.
1 次查看(过去 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!