Professional Documents
Culture Documents
%Corresponding x-coordinates:
x = c/2*(1 - cos(beta));
%Top part:
x_t = x(1:Npanel+1);
if m == 0 && p == 0
x_b = x(Npanel+1:2*Npanel);
%x_t is for the top side and goes from the leading edge to the trailing
%edge. x_b is for the bottom and goes from the trailing edge to the
%leading edge. This is because of the setup of the matrices defined at
%the bottom of page 282 in the Katz and Plotkin book which incorporate
%the Kutta condition into the simulation.
z_b = -(z_t(end:-1:2));
else
%Divide into two parts: that where x is less than p*c and that where is
%equal to or greater than p*c. First step is determining transition:
[~,x_transition] = min(abs(x_t - p*c));
z = horzcat(z_l(1:end-1),z_u);
x = horzcat(x_l(1:end-1),x_u);
end
%Calculate theta_i:
dz = diff(z);
dx = diff(x);
theta = atan2(dz,dx);
sin_theta = -sin(theta);
cos_theta = cos(theta);
%Definition of atan2 means angles have the wrong sign, hence the fix
%above.
%Note - those referring to the code in the back will find sin(alpha) is
%missing a sign. Because of this, the matrices used for the
%transformations to and from the panel coordinate system are slightly
%different to those defined by equations 11.23 and 11.23a. Again, it's
%to do with the definition of atan2.