function p = g2(theta,phi)

N = length(theta);
p = zeros(1,N);


%d1 = 2.5
%data = [-8.37068977241838,0.645728373939231;-6.69520408896709,60.8031798595752;-5.02061738094106,158.011478314751;-3.34670429275585,224.102649993342;-1.67323999300445,269.181471341587;0,269.111662868728;1.67323999300445,258.396062284980;3.34670429275585,182.060497214434;5.02061738094106,59.6862442938425;6.69520408896709,8.74351122550148;];

%d1 = 3
data = [-8.10611590174281,0.666791527387586;-6.48349474796565,62.7865319302257;-4.86180624776766,163.165688891005;-3.24081639858870,231.412702788756;-1.62029191725024,277.961959957463;0,277.889874386934;1.62029191725024,266.824739310827;3.24081639858870,187.999167938035;4.86180624776766,61.6331628017715;6.48349474796565,9.02871770868056;];

data(:,1) = pi/180*data(:,1);
M = length(data(:,1));

for i = 1:N
    delta = theta(i)-phi;
    if ((data(1,1)<delta)&&(delta<data(M,1)))
        % find the point on the list 'data'
        for j = 1:(M-1)
            if (delta > data(j,1))
                break;
            end
        end
        p(i) = data(j,2)+(data(j+1,2)-data(j,2))/(data(j+1,1)-data(j,1))*(delta-data(j,1));
    else
        p(i) = 0;
    end
end