how can i plot the difference of two different plots?
Show older comments
clear
clc
a = 7000000; %7000km
e = 0.01;
tol = 10e-12;
tweek = 604800;
n = sqrt((3.986012e14)/(a^3));
i = 1;
t=zeros(1,tweek/60);
t(i)=0;
p = a*(1-e^2);
while (i <tweek/60)
M = n * t(i);
E = kepler (M, e, tol);
v = 2*atan ( (sqrt((1+e) / (1-e)))*tan(E/2) );
r(i) = p / (1 + e*cos(v));
i = i+1;
t(i)=t(i-1)+60;
end
M = n * t(i);
E = kepler (M, e, tol);
v = 2*atan ( (sqrt((1+e) / (1-e)))*tan(E/2) );
r(i) = p / (1 + e*cos(v));
%position vs time
figure;
plot (t,r)
x0 = zeros(6,1);
x0(1) = 5.047068033439438e6;
x0(2) = 3.680670525302932e6;
x0(3) = 3.000778024113080e6;
x0(4) = -4.709914732434172e3;
x0(5) = 1.797919411934430e3;
x0(6) = 5.716421195462119e3;
tspan = 0 : 60 : 604800;
options = odeset('RelTol', 1e-12, 'Abstol', [1e-12 1e-12 1e-12 1e-12 1e-12 1e-12]);
[T,X] = ode45(@twobodyprob, tspan, x0, options);
%position vs time
[m,n] = size(T);
figure;
plot(T,X(:,1), '-', T,X(:,2), '-', T,X(:,3), '.')
Answers (1)
Artur M. G. Lourenço
on 11 Nov 2011
0 votes
for me show this:
??? Undefined function or method 'kepler' for input arguments of type 'double'.
>> help kepler
kepler not found.
Use the Help browser search field to search the documentation, or type "help help" for help command options, such as help for methods.
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!