function [guideAccel] = getGuidance(Mt,missileState,targetState) % This function computes the acceleration command to the missile required to % intercept a target missileState = missileState(:); targetState = targetState(:); % Compute proportional navigation (PN) guidance command PNGain = 0; % PN guidance gain terminalPNGain = 4; KVP = 0.5; blindRng = 2; %Seeker blind range (m) acqRng = 5000; % Acquisition Range (m) g = 9.8066; % Acceleration due to gravity (m/sec^2) gLimit = 40.; % Lateral acceleration limit in gees relState = targetState - missileState; relRng = relState(1:3); relVel = relState(4:6); mslVel = missileState(4:6); % Velocity pursuit guidance if Mt>0.5 nHat = cross(mslVel,relRng); accelCmdVP = KVP*cross(nHat,mslVel/norm(mslVel))/norm(relRng); else accelCmdVP = [0; 0; 0]; end if norm(accelCmdVP)>gLimit*g accelCmdVP = gLimit*g*accelCmdVP/norm(accelCmdVP); end % LOSR is line-of-sight rate LOSR = cross(relRng,relVel)/dot(relRng,relRng); if norm(relRng)gLimit*g accelCmd = gLimit*g*accelCmd/norm(accelCmd); end guideAccel = accelCmd + accelCmdVP; if norm(relRng)