Plot two functions with different pause rates at same time.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aidan McGlone
am 14 Sep. 2021
Kommentiert: Aidan McGlone
am 16 Sep. 2021
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 Kommentare
Akzeptierte Antwort
Mohammad Sami
am 15 Sep. 2021
Bearbeitet: Mohammad Sami
am 15 Sep. 2021
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!