Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function example
- r = 1;
- i = pi/9;
- Omega = pi/6;
- omega = pi/3;
- cos_Omega = cos(Omega);
- sin_Omega = sin(Omega);
- % cos_omega = cos(omega);
- % sin_omega = sin(omega);
- cos_i = cos(i);
- sin_i = sin(i);
- a = 0;
- b = 2*pi;
- t = [a:(b-a)/180:b];
- x = y = z = zeros(1, length(t));
- [X, Y, Z] = sphere(25);
- mesh(X*0.7, Y*0.7, Z*0.7);
- axis ([-1 1 -1 1 -1 1]);
- grid on
- hold on
- first = true;
- sputnik = 0;
- k = 1;
- x1 = r*(cos_Omega*cos(t(k)+omega)-sin_Omega*sin(t(k)+omega)*cos_i);
- y1 = r*(sin_Omega*cos(t(k)+omega)+cos_Omega*sin(t(k)+omega)*cos_i);
- z1 = r*sin(t(k)+omega)*sin_i;
- for k = 2:length(t)
- x2 = r*(cos_Omega*cos(t(k)+omega)-sin_Omega*sin(t(k)+omega)*cos_i);
- y2 = r*(sin_Omega*cos(t(k)+omega)+cos_Omega*sin(t(k)+omega)*cos_i);
- z2 = r*sin(t(k)+omega)*sin_i;
- plot3([x1, x2], [y1, y2], [z1, z2], 'r');
- x1 = x2;
- y1 = y2;
- z1 = z2;
- if (~first)
- delete(sputnik);
- else
- first = false;
- end
- [X, Y, Z] = sphere(6);
- R = 0.05;
- X = x1 + R * X;
- Y = y1 + R * Y;
- Z = z1 + R * Z;
- sputnik = surf(X, Y, Z);
- pause(0.001);
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement