Use Matlab to solve the following
(a) Create a plot with a sphere at the center of the graph (origin) representing the sun with a radius of 6955000 km. Make sure that the outside of the sphere is painted in ’autumn’ colors. (Hint: look up the sphere() function, the colormap() function, and the surf() function).
(b) Create a variable t ranging from 0 to 2? with increments of 0.01.
(c) The following Table gives you important values needed to compute the orbits.
Planet | Semi-major axis (a) in km | Eccentricity (e) |
Mercury | 57909335.9 | 0.206 |
Venus | 108204140 | .007 |
Earth | 149597871 | .017 |
The equation for a two dimensional elliptical orbit using Kepler’s law is given by: x = a cos(t) and y = b sin(t) Where, b = a sqr(1 ? e^2) Using the above equations, compute the x-coordinates and y-coordinates for the elliptical orbit of Mercury
(d) As in part (d), compute the x-coordinates and y-coordinates for the elliptical orbit of Venus and Earth.
(e) Create a vector z of zeros that has the same length as the vector t from part (b). This is the z-coordinates for the Earth’s, Mercury’s, and Venus’ orbits.
(f) Plot the Mercury’s orbit in the same plot as the sun sphere. Remember that the center of the orbit is at the origin, and use a green line for this plot. (Hint: look up plot3()).
(g) Plot Venus’ orbit in the same plot as the sun sphere. Remember that the center of the orbit is at the origin, and use a red line for this plot. (Hint: look up plot3()).
(h) Plot Earth’ orbit in the same plot as the sun sphere. Remember that the center of the orbit is at the origin, and use a blue line for this plot. (Hint: look up plot3()).
(i) Add label to the axis and include units km. Title the graph ’Kepler’s Law of Planetary Motion’. Adjust the axis to be all equal. (Hint: look up axis).
clc;
clear;
[x,y,z] = sphere;
% figure;
surf(x+6955000,y+6955000,z+6955000);
colormap('autumn');
hold on
a = 57909335.9;
e = 0.206;
t = 0:0.01:2;
b = a*sqrt(1 - e^2);
x = a*cos(t);
y = b*sin(t);
z = zeros(size(t));
plot3(x,y,z,'g')
hold on
a = 108204140;
e = 0.007;
b = a*sqrt(1 - e^2);
x = a*cos(t);
y = b*sin(t);
z = zeros(size(t));
plot3(x,y,z,'r')
hold on
a = 149597871;
e = 0.017;
b = a*sqrt(1 - e^2);
x = a*cos(t);
y = b*sin(t);
z = zeros(size(t));
plot3(x,y,z,'b')
title 'Kepler’s Law of Planetary Motion'
Get Answers For Free
Most questions answered within 1 hours.