How do I color my orbits based off of Jacobi Constant?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
N/A
le 7 Fév 2024
Réponse apportée : Star Strider
le 7 Fév 2024
This is what I want my plot to look like:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1611151/image.png)
This is what my plot looks like:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1611156/image.png)
This is my plot code with Jacobi Constant vector:
figure(1), color_map = jet(15);
grid on, hold on,
for ii = 1:15
plot(x(:, 1), x(:, 2), 'Color', color_map(ii, :), 'Linewidth', 1),
xlabel('x, NDU'), ylabel('y, NDU'),
plot(L(1, 1), 0, 'k.', 'MarkerSize', 20),
text(L(1, 1) + 0.013, 0, 'L1', 'Color', 'k'),
plot(L(2, 1), 0, 'k.', 'MarkerSize', 20),
text(L(2, 1) + 0.013, 0, 'L2', 'Color', 'k'),
plot(L(3, 1), 0, 'k.', 'MarkerSize', 20),
text(L(3, 1) + 0.005062645806268, 0, 'L3', 'Color', 'k'),
plot(L(4, 1), L(4, 2), 'k', 'Markersize', 20),
text(L(4, 1) - 0.05, L(4, 2) + 0.05, 'L_4', 'Color', 'k'),
plot(L(5, 1), L(5, 2), 'k', 'Markersize', 20),
text(L(5, 1) - 0.05, L(5, 2) - 0.05, 'L_5', 'Color', 'k'),
plot(1 - mu, 0, 'k.', 'MarkerSize', 20),
text(1 - mu + 0.013, 0, 'Moon', 'Color', 'k'),
plot(-mu, 0, 'k.', 'MarkerSize', 20),
text(-mu + 0.02, 0, 'Earth', 'Color', 'k'),
end
colorbar
C =
3.007676099413564
2.994200622706611
2.971545695246074
2.939417270410701
2.897381208873815
2.844828980359512
2.780923329169862
2.704511298825675
2.613980216377739
2.507005968545220
2.380077662128345
2.227495703195107
2.038881730418720
1.791003662001313
1.396075232221978
My central problem is that the Jacobi Constant values are not integers and I am not sure how to associate each value with a color to plot. This code has many support functions and I did not add them here. Hopefully this is enough to answer the question.
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Contour Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!