I had a question regarding transforming kepler elements to cartesian coordinates. I have the following MATLAB code that does the transformation. But what if the kepler elements given were changed from (a, ecc, inc, raan, argp, f) to (a, ex, ey, inc, raan, theta) where ex and ey are the x and y components of eccentricity and theta is argument of latitude = argp + f. How would the following equations in the code change? We no longer have ecc or argp or f(true anomaly) as inputs. % Calculate angular momentum h = sqrt(a * (1-ecc^2)*mu); % (km^2/s) % Calculate position and velocity in the periforcal frame r_w = ((h^2 / mu) / (1 + ecc * cosd(f))) .* [cosd(f), sind(f), 0]; v_w = (mu / h) .* [-sind(f), ecc + cosd(f), 0]; % Define the Rotational Matrices R1 = [cosd(-argp) -sind(-argp) 0; sind(-argp) cosd(-argp) 0; 0 0 1]; R2 = [1 0 0; 0 cosd(-inc) -sind(-inc); 0 sind(-inc) cosd(-inc)]; R3 = [cosd(-raan) -sind(-raan) 0; sind(-raan) cosd(-raan) 0; 0 0 1]; % Calculate position vector r_rot = r_w * R1 * R2 * R3; % Calculate velocity vector v_rot = v_w * R1 * R2 * R3;
I had a question regarding transforming kepler elements to cartesian coordinates. I have the following MATLAB code that does the transformation. But what if the kepler elements given were changed from (a, ecc, inc, raan, argp, f) to (a, ex, ey, inc, raan, theta) where ex and ey are the x and y components of eccentricity and theta is argument of latitude = argp + f. How would the following equations in the code change? We no longer have ecc or argp or f(true anomaly) as inputs.
% Calculate angular momentum
h = sqrt(a * (1-ecc^2)*mu); % (km^2/s)
% Calculate position and velocity in the periforcal frame
r_w = ((h^2 / mu) / (1 + ecc * cosd(f))) .* [cosd(f), sind(f), 0];
v_w = (mu / h) .* [-sind(f), ecc + cosd(f), 0];
% Define the Rotational Matrices
R1 = [cosd(-argp) -sind(-argp) 0;
sind(-argp) cosd(-argp) 0;
0 0 1];
R2 = [1 0 0;
0 cosd(-inc) -sind(-inc);
0 sind(-inc) cosd(-inc)];
R3 = [cosd(-raan) -sind(-raan) 0;
sind(-raan) cosd(-raan) 0;
0 0 1];
% Calculate position
r_rot = r_w * R1 * R2 * R3;
% Calculate velocity vector
v_rot = v_w * R1 * R2 * R3;
Trending now
This is a popular solution!
Step by step
Solved in 4 steps