Calculations/MOT Capture Process Simulation/@MOTSimulator/calculateCaptureVelocity.m

25 lines
760 B
Matlab

function ret = calculateCaptureVelocity(this, PositionVector, VelocityVector)
VelocityVector = VelocityVector./norm(VelocityVector);
UpperLimit = 500;
LowerLimit = 0;
for Index = 1:500
InitialVelocity = 0.5 * (UpperLimit + LowerLimit) * VelocityVector;
[~, FinalDynamicalQuantities] = this.solver(PositionVector, InitialVelocity);
FinalPositionVector = FinalDynamicalQuantities(1:3);
if rssq(FinalPositionVector) <= this.OvenDistance
LowerLimit = 0.5 * (UpperLimit + LowerLimit);
else
UpperLimit = 0.5 * (UpperLimit + LowerLimit);
end
if UpperLimit - LowerLimit < 1
ret = InitialVelocity;
break;
end
end
clear Index
end