Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Simulation of Sun-Earth system in MATLAB | M-file

Code:



clc
clear all
close all
t=0:0.03:2*pi;
x=-6+cos(t);
y=sin(t);
esa=fill(0.2*x,0.2*y,'y');
hold on;
x=2*cos(t);
y=sin(t);
plot(x,y,'b--');
axis square;
hold on;
x=[x x x x x x x x x x x x x x x];
y=[y y y y y y y y y y y y y y y];
for i=1:length(x)
    e=x(i)+0.1*cos(t);
    f=y(i)+0.1*sin(t);
    h=fill(e,f,'b');
    axis([-4 4 -4 4]);
    drawnow
    delete(h);
end

No comments

Popular Posts

Followers