Need help with 4 digit airfoil
Afficher commentaires plus anciens
We were given an outlined code in our engineering class for a 4 digit airfoil. I have input all equations and the program runs, however it doesn't seem right. Any help would be appreciated.
clear all
close all
c=1; %chord length
s=num2str(2412);
NACA=s; %4 digits
d1=str2double(s(1)); % pulls the first digit out of the scalar
d2=str2double(s(2));% pulls the second digit out of the scalar
d34=str2double(s(3:4)); % pulls the third and fourth digit out of the scalar
m=d1/100;
p=d2/10;
t=d34/100;
x=0:0.1:c;
yt =5*t*c*(.2969*(sqrt(x/c))+-.1260*(x/c)+-.3516*(x/c).^2+.2843*(x/c).^3+-.1015*(x/c).^4);
for k = 1:length(x)
if x(k) <= p*c
yc(k)=m*(x(k)/p^2)*(2*p-(x(k)/c));
dx(k)=(2*m)/p^2*(p-(x(k)/c));
elseif x(k) > p*c
yc(k)=m*((c-x(k))/(1-p)^2)*(1+(x(k)/c)-(2*p));
dx(k)=((2*m)/(1-p)^2)*(p-(x(k)/c));
end
end
%upper and lower limits of the airfoil (xu,yu) ; (xl,yl)
theta=atan(dx(k));
xu=x(k)-yt(k)*sin(theta);
yu=yc(k)+yt(k)*cos(theta);
xl=x(k)+yt(k)*sin(theta);
yl=yc(k)-yt(k)*cos(theta);
%plot of airfoil
plot(xu,yu)
hold on
plot(xl,yl,'r')
plot(x,yc,'g')
axis equal

grid on
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Airfoil tools dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
