Code not showing any result or any error
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clc
clear all
close all
e = 0.1;
M_min = 0;
M_max = 2 * pi;
N = 20;
function [E, M] = kepler_plot(e, M_min, M_max, N)
f = @(E) E - e * sin(E) - M;
M = linspace(M_min, M_max, N);
E = fzero(f, 0, M);
plot(M, E)
xlabel('Mean Anomaly')
ylabel('Eccentric Anomaly')
title('Keplers Equation')
end
this is the code. matlab is not showing any error or any result.
0 commentaires
Réponses (1)
Walter Roberson
le 28 Mai 2023
Your code defines kepler_plot but never invokes it.
But you have other problems as well. I had to guess what you were doing.
e = 0.1;
M_min = 0;
M_max = 2 * pi;
N = 20;
[E, M] = kepler_plot(e, M_min, M_max, N)
function [E, M] = kepler_plot(e, M_min, M_max, N)
f = @(E,m) E - e * sin(E) - m;
M = linspace(M_min, M_max, N);
E = arrayfun(@(m) fzero(@(E)f(E,m), 0), M);
plot(M, E)
xlabel('Mean Anomaly')
ylabel('Eccentric Anomaly')
title('Keplers Equation')
end
0 commentaires
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!