%% kp2ap.m converts from Kp solar magnetic activity index to
%% Ap solar magnetic index.
%%

function ap=kp2ap(kp);

% ap = Ap index of points of interest
% kp = Kp index of points of interest

apv=[0 3 7 15 27 48 80 140 240 400];    %Ap vector
kpv=0:9;                                %Kp vector
kps=size(kp);                           %size of input 
kp=kp(:);                               %reshape to a column vector
ap=interp1(kpv,apv,kp,'spline');        %determine the corresponding Ap values
ap=reshape(ap,kps);                     %reshape to orignal input size
