Sei sulla pagina 1di 1

function [x,y,z] = gen_naca_sym (c, t, width, lead_edge)

% Syntax [x,y,z] = gen_naca_sym (c, t, cw, le)


% generates symmetrical NACA airfol according to NACA specs at
% http://en.wikipedia.org/wiki/NACA_airfoil
%
% c is the chord length in any units.
% t is the maximum thickness as a fraction of the chord (so 100 t gives the last
two digits in the NACA 4-digit denomination). for example, t=0.15 will generate
NACA 0015.
% cw is cover width (for example, enter 2 for 2mm balsa).
% le is width of leading edge (useful for seeing where it should begin, for exam
ple 8 for 8mm balsa).
%
% it can be exported to DXF using writedxfline ('naca0015',x,y,z)
% from http://www.mathworks.com/matlabcentral/fileexchange/4895-dxf-export-for
-3d-line-elements/content/writedxfline.m
%
% (c) Honza Cernocky, 2012.
N1 = 50; % number of points at the beginning of profile until .1 of its length.
N2 = 50; % number of points in the rest.
x = c * [linspace(0,0.1,N1) linspace(0.1 + 0.9/N2, 1, N2)];
y = t/0.2 * c * (0.2969 * sqrt(x/c) - 0.1260 * (x/c) - 0.3516 *(x/c).^2 + 0.2843
* (x/c).^3 - 0.1015 * (x/c).^4); % see wikipedia for definition...
% convert it into comples numbers ...
X = x + j*y;
N = length(X);
% now generate the line below the profile
derivatives = X- [0, X(1:(N-1))];
normals = derivatives * (-j); % just turn -pi/2 in the complex plane ;-)
normals(1) = 1; % hard definition.
normals = normals ./ abs (normals); % normalize to unit size.
rib = X + normals * width; % generate the rib.
% clip negative values to zero.
ibadrib = find (imag(rib) < 0);
rib(ibadrib) = real (rib(ibadrib));
% now the leading edge - just draw a square the height of max profile height ...
ymax = max(y);
edge = [0, j*ymax, j*ymax+lead_edge, -j*ymax+lead_edge, -j*ymax, 0];
% generate the whole thing ... 'c' generates the axis at the end
OUT = [X, conj(fliplr(X)), rib, conj(fliplr(rib)), edge, c]; % conjugation chan
ges sign of imag part!
%plot (OUT);
% output it as real numbers ...
x = real(OUT);
y = imag (OUT);
z = zeros (size(x));

Potrebbero piacerti anche