Table_Cp_table = [0.032 0.084 0.098 0.138 0.206 0.25;...
0.029 0.075 0.094 0.132 0.198 0.242;...
0.025 0.066 0.088 0.128 0.188 0.233;...
0.022 0.058 0.08 0.12 0.178 0.223;...
0.009 0.045 0.07 0.11 0.163 0.214;...
-0.057 0.01 0.05 0.099 0.15 0.204;...
-0.188 -0.074 0.02 0.078 0.13 0.19;...
-0.338 -0.188 -0.04 0.04 0.105 0.175;...
-0.522 -0.338 -0.134 -0.017 0.07 0.15;...
-0.705 -0.525 -0.272 -0.11 0.023 0.118;...
-0.915 -0.726 -0.468 -0.248 -0.074 0.072;...
-1.092 -0.942 -0.717 -0.468 -0.254 0.019;...
-1.22 -1.12 -0.933 -0.741 -0.51 -0.059];
Table_Cp_x = [15 20 25 30 35 40];
Table_Cp_y = [0:0.2:2.4];
S = 10.81;
b = 9.3;
Cd0 = .02;
Clmax = 1.7;
eff = .6;
weight = 750;
RatedPower = 180;
RatedRPM = 2700;
D = 74/12;
Vne = 320;
ClminD = 0.3;
Clmin = -1;
MaxAlpha = 16;
MinAlpha = 10;
Gmax = 6;
Gmin = -5;
polar.alpha = [MinAlpha:1:MaxAlpha];
Clrate = (Clmax-Clmin)/(MaxAlpha/MinAlpha);
polar.Cl = Clrate.*(polar.alpha-MinAlpha)-Clmin;
polar.Cd = Cd0+(polar.Cl-ClminD).^2./(pi()*eff*b^2/S);
manPress = 29.92;
rho = 1.225;
Output.AkroHorRho = rho;
Vcas = [10:10:Vne];
Vcas = Vcas./3.6;
theta = [-90:5:90]';
lengthTheta = length(theta);
Output.Pspecific = [];
posNLimit = min(Gmax,Clmax*rho*Vcas(1)^2*S/(2*g0*weight));
negNLimit = max(Gmin,Clmin*rho*Vcas(1)^2*S/(2*g0*weight));
Nzpos = [0:0.1:posNLimit];
Nzneg = [0:-0.1:negNLimit];
Nz = [flip(Nzneg),Nzpos]';
lengthNz = length(Nz);
repTheta = repmat(theta,lengthNz,1);
Nz = repelem(Nz,lengthTheta,1);
Vx = Vcas(1)*cosd(repTheta);
Vy = Vcas(1)*sind(repTheta);
rpm = ones(length(repTheta),1);
VmagUS = Vmag.*3.28;
rho = rho.*.0023769/1.225;
maxManifold = rho./.0023769.*29.92;
manPress = min(maxManifold,manPress);
P = RatedPower.*manPress./29.92.*rpm./RatedRPM;
n = RatedRPM*ones(length(repTheta),1)./60;
AdvanceRatio = 0.032832832832833*ones(size(VmagUS));
Cp = P.*550./(rho.*n.^3*D.^5);
AdvanceRatioRow = interpn(Table_Cp_y,Table_Cp_x,Table_Cp_table,AdvanceRatio,Table_Cp_x,'*linear');
[indexMesh, Table_Cp_xMesh] = ndgrid([1:length(Cp)]',Table_Cp_x);
bladeAngle = interpn(indexMesh,AdvanceRatioRow,Table_Cp_xMesh,[1:length(Cp)]',Cp,'*linear');