MATLAB Answers

Tidal acceleration of the Earth affected from sun and moon

17 views (last 30 days)
Basem Nouh
Basem Nouh on 13 Jan 2021
Answered: SaiDileep Kola on 19 Jan 2021
hey
i want to write a code to calculate the Tidal acceleration in 3 ways
A: Sun and moon in the equatorial plane. Centers of mass of the sun, moon and earth and point P are on a line (center of mass of the earth - P - moon - sun)
.B: Sun and moon in the equatorial plane. The centers of mass of the sun, moon and earth and point P are on a line (P - center of mass of the earth - moon - sun)
.C: Sun and moon in the equatorial plane (as above). Point P is at the North Pole.
i wanted to write a code with case condition but i dont know how to call it, i wanna say if case =A then do this
also i have no idea how to write the vector on Matlab
function [a_t] = gezeitenbesch(G,M_m,M_s,r_e,r_m,r_s)
a_g1 = G*M_m/((r_m)^2);
a_g2 = G*M_s/((r_s)^2);
a_g3 = G*M_s/((r_s+r_e)^2);
a_t1 =a_g1-a_g3;
a_t2 =a_g2-a_g3;
a_t = a_t1+a_t2;
end
% Gravitationsbeschleunigung
G = 6.67408e-11; %[m3/kgs2]
M_m = 7.3483e22 ;% [kg]
M_s = 1.989e30; %[Kg]
r_m = 3.8440*10^8; % [m]
r_s = 1.496*10^11 ; %[m]^3;
r_e = 6378*10^3;
a_t =gezeitenbesch(G,M_m,M_s,r_e,r_m,r_s)
is there any way to plot it ?
thanks

Answers (1)

SaiDileep Kola
SaiDileep Kola on 19 Jan 2021
Go through the process described here to know more about switch cases and to use them just have it in your code, need not do anything else like for functions, check for various ways of using vectors here

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!