Code not showing any result or any error
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Walter Roberson
2023 年 5 月 28 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!