Code covered by the BSD License

### Danny Sale (view profile)

18 Sep 2012 (Updated )

Analysis and design of composite blades for wind and hydrokinetic turbines

```function NormAFcoords = interpAirfoilCoords(OrigNormAFcoords, BLADE)

case 'none'
% we still need to interpolate the coordinates to measure the percent
% thickness, but we will use the original airfoil coordinates in the end
x_cUp = linspace(0, 1, 200 + 1)';

case 'equal'
x_cUp = linspace(0, 1, BLADE.N_AF/2 + 1)';

case 'cosine'
x_cUp = cosspace(0, 1, BLADE.N_AF/2 + 1, 'both');
end
x_cLo = flipud( x_cUp );

oldX           = OrigNormAFcoords(i).x;
oldY           = OrigNormAFcoords(i).y;
[unused i_TE]  = min(abs(oldX - 1)); % find the index of the trailing edge
oldXup         = oldX(1:i_TE);
oldYup         = oldY(1:i_TE);
oldXlo         = [oldX(i_TE:end); 0];
oldYlo         = [oldY(i_TE:end); 0];

newYup = interp1(oldXup, oldYup, x_cUp);
newYlo = interp1(oldXlo, oldYlo, x_cLo);

NormAFcoords(i).x           = [x_cUp; x_cLo(2:end-1)];
NormAFcoords(i).y           = [newYup; newYlo(2:end-1)];
NormAFcoords(i).maxPerThick = max(newYup - flipud(newYlo));
end

case 'none'
% overwrite the interpolated coordinates with the original coordinates
NormAFcoords(i).x = OrigNormAFcoords(i).x;
NormAFcoords(i).y = OrigNormAFcoords(i).y;
end
otherwise
return
end

end % function interpAirfoilCoords

```