function kappa=kappa2(x,sinphialp)
% Goldstein's kappa function for two bladed propeller
% This version has been updated to eliminate the use of function table2.
% 9/18/07
% tab=[      sin(phi+ai)1, sin(phi+ai)2 ...
%       r1/R
%       r2/R
%       ....
tab=[000,0.00,0.05,0.10,0.20,0.30,0.40,0.50,0.60,0.70,0.80,0.90,1.00,
    0.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,
	0.30,1.00,1.00,1.00,.994,.978,.958,.944,.930,.922,.916,.935,1.02,
    0.35,1.00,1.00,1.00,.993,.961,.940,.912,.880,.855,.837,.843,.891,
    0.40,1.00,1.00,.999,.992,.955,.923,.880,.833,.788,.757,.750,.762,
    0.45,1.00,1.00,.998,.991,.959,.906,.848,.784,.722,.677,.657,.633,
    0.50,1.00,1.00,.998,.981,.930,.865,.794,.725,.663,.618,.592,.563,
    0.55,1.00,1.00,.997,.971,.902,.824,.742,.666,.605,.560,.528,.494,
    0.60,1.00,1.00,.997,.961,.874,.783,.690,.608,.547,.502,.464,.425,
    0.65,1.00,.999,.992,.931,.824,.723,.627,.550,.494,.448,.412,.375,
    0.70,1.00,.999,.988,.901,.774,.663,.564,.492,.441,.398,.360,.325,
    0.75,1.00,.997,.971,.852,.709,.595,.501,.435,.387,.347,.311,.279,
    0.80,1.00,.994,.937,.784,.634,.520,.434,.376,.333,.297,.265,.238,
    0.85,1.00,.985,.877,.694,.548,.442,.367,.316,.278,.247,.220,.197,
    0.90,1.00,.950,.773,.578,.444,.351,.289,.249,.218,.193,.172,.154,
    0.95,1.00,.780,.586,.415,.308,.243,.199,.171,.149,.131,.117,.105,
	1.00,1e-3,1e-3,1e-3,1e-3,1e-3,1e-3,1e-3,1e-3,1e-3,1e-3,1e-3,1e-3];
%kappa=diag(table2(tab,x,sinphialp))'
%[rows1,cols1]=size(kappa)


% Updated code to do away with function table2
[N,M]=size(tab);
Y=tab(2:N,1);
%[Yrow,Ycol]=size(Y);
Xx=tab(1,2:M);
%[Xrow,Xcol]=size(Xx);
Z=tab(2:N,2:M);
%[zrow,zcol]=size(Z);

% sinphialp and x should be row vectors
[srow,scol]=size(sinphialp);
if srow>1 
    sinphialp=sinphialp'; 
end

[xrow,xcol]=size(x);
if xrow>1 
    x=x'; 
end

kappa=interp2(Xx,Y,Z,sinphialp,x);

