0
votes

I have a matrix which comprises of data of calculated motions of the planets which gets calculated through an ODE and then plotted, I need to plot each of the planets separately, is it possible to do this in real time by using a set function for just the one matrix, or would I have to break the matrix up accordingly? (There are 60 columns for the x,y,z position and velocity of the Sun, Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto) The columns in this matrix that I need to plot are the first three of every group of six

Thanks

Chris

1

1 Answers

0
votes

Is it possible to do this in real time by using a set function for just the one matrix, or would I have to break the matrix up accordingly?

It depends on how you are plotting.

For example if you define all of the planets as a line with markers then you can update using a single command:

% create the line object
l = line(x,y,z,'color','r', 'linestyle', 'none', 'marker', '.', 'markersize', 20);

% update the positions
set(l,'XData', planetPositions(:,1), 'YData', planetPositions(:,2), 'ZData', planetPositions(:,3));

However if the planets are drawn individually then you'll need to update their positions one by one.