Run a code for 100 years
1 回表示 (過去 30 日間)
古いコメントを表示
I have a program that I need to run for 100 years, the program is calculating the angle of a circular orbit at 451 days. I want to calculate the angle changing over 100 years, I have the angle calculated for 451 days just want to repeat the same process but add 451 to the last calculation. T=451 days my idea was to have a for loop for the 100 years starting at T=451 days for the first year and then adding 451 to T for each year till 100.
clear all;
clc;
ro=1.49e11; %Sun orbital radius (1 AU)
G=6.67408e-11;
MS=2e+30;
%synodic period
perp = 365; %planet period (days)
perd = 1896.59; %red dwarf period (days)
np = 2*pi / perp; % mean motion of planet (rad/day)
nd = 2*pi / perd; % mean motion of red dwarf (rad/day)
T = 2*pi / (np - nd) %This is the average time between stellar eclipses.
v=sqrt((G*MS)/ro);
theta=((v*T)*86400)/ro %Angle in radians
0 件のコメント
採用された回答
Les Beckham
2020 年 4 月 11 日
I don't think the results are going to be very interesting but you could do what you are asking as follows:
ro=1.49e11; %Sun orbital radius (1 AU)
G=6.67408e-11;
MS=2e+30;
%synodic period
perp = 365; % planet period (days)
perd = 1896.59; % red dwarf period (days)
np = 2*pi / perp; % mean motion of planet (rad/day)
nd = 2*pi / perd; % mean motion of red dwarf (rad/day)
dT = 2*pi / (np - nd); % This is the average time between stellar eclipses.
v=sqrt((G*MS)/ro);
T = dT:dT:dT*ceil(100*perp/dT); % up to next multiple of dT after 100 years (multiples of perp)
theta=((v*T)*86400)/ro % Angle in radians at each multiple of dT
This is just going to add a constant increment to theta every dT. If you plot(T, theta) you will get a boring straight line. You could, of course, apply a mod by 2*pi but this won't be much more useful (IMHO).
Anyway, I hope this answers your question. If not, please clarify.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Gravitation, Cosmology & Astrophysics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!