Simultaneous Plotting of many trajectories together in one plot
Show older comments
I have two matrices representing the X and Y coordinates of various particles over time. For example if my dataset contains three particles each of which existed for 5 time units then the matrices that I will have is as follows:
Xcoordinates= [120,121,126,128,130; 107,106,106,105,105; 128,128,130,132,136];
Ycoordinates=[73,75,76,74,78; 76,80,82,87,85; 39,39,40,41,45];
Here, each row is representing one object and the columns are representing its position (X/Y coordinate) at any instant of time.
I want to plot the trajectories of the particles in the same graph. For this, presently I am using a for loop:
for i = 1: size(Xcoordinates,1)
plot(Xcoordinates(i,:),Ycoordinates(i,:))
hold on
end
hold off
I have attached the image that I get. I have many objects (~ 1000s which have lifetimes of 100s of units), thereby making the for loop very slow. Is there anyway to simultaneously plot all the objects without using a for loop?
Accepted Answer
More Answers (0)
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!