So I essentially want to plot the change in trajectory as I perform a maneuver using the clohessy wiltshire equations to chase a target. I have a for loop for 10,000s and I would like to calculate each value of r(t) as I run through the loop and then plot it. Anyone know how this would be done? I can post code if you like.


Quick hack:

close all

phi_rr = @(t) [4-3*cos(n*t) 0 0; 6*(sin(n*t)-n*t) 1 0; 0 0 cos(n*t)];
phi_rv = @(t) [1/n*sin(n*t) 2/n*(1-cos(n*t)) 0; 2/n*(cos(n*t)-1) 1/n*(4*sin(n*t)-3*n*t) 0; 0 0 1/n*sin(n*t)];

r_0 = [100;0;0];
v_0 = [-1;-.115;0];


% plot red circle at origin
hold on

% start loop
for t=T
    % display 50% progres
    if t==T(floor(end/2))
        disp('50 % done');
    r=phi_rr(t)*r_0 + phi_rv(t)*v_0;
xlabel('x'), ylabel('y'), zlabel('z')
axis equal
grid on
hold off

According to wikipedia and this, x-axis points radially from center of gravity to the target, y-axis points into the targets direction of movement, and the z-axis is just perpendicular to the previous (right-handed system). So, with the initial values provided as an example above, the trajectory looks like this:

example trajectory relative to the target

The view is relative to the target (red circle), i.e. how the target sees the chaser move.

That means the chaser starts at 100 meters radially outwards of the target's position and with a velocity of -1 m/s radially inwards and -11.5 cm/s tangentially backwards relative to the target.

The chaser hits the target with non-zero velocity. So to make it more realistic, you'd have to do a multi-step simulation with subsequently decreasing velocity of the chaser.

  • $\begingroup$ Cheers! So I'm not quite sure whats going on with the "if t ===floor(T(end)/2) disp('50% done') bit..can you explain what its for? $\endgroup$ – Harvey Rael Feb 23 '18 at 16:22
  • $\begingroup$ Good question! It is supposed to display when approx. 50 % of the calculation is done, since it can take a long time if T contains many numbers. But the way I coded it didn't make much sense... fixed! $\endgroup$ – Everyday Astronaut Feb 23 '18 at 16:33
  • $\begingroup$ so, to clarify your last point in your own answer (as I see you have a question related to it), you would do another burn that brings your relative velocity to zero at the target. The nature of these equations is such that for a given end condition, you can find the initial condition, so your v0 would be the values you need to be flying with to reach your target with 0 relative velocity, where as it seems you've picked an arbitrary value. Hope that helps with your other question too! $\endgroup$ – Harvey Rael Feb 24 '18 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.