Interpolating Airfoil Data

5 次查看(过去 30 天)
Karim Alame
Karim Alame 2012-4-17
Hi everyone, I downloaded a library with all different kinds of airfoils from NACA to EPPLER etc... I'm running a potential flow code and essentially I want to be able to control the number of panels on the airfoil(user specified) for accuracy purposes. The Library however has airfoil set at 35 coordinate points. I've been trying to use the interpolate function but no cigar my numbers are off. Can anyone look at this function and see if there's any other way to make it more efficient or spot the errors I'm going through? For a general purpose it does the job there's only a couple of points that are offset but I guess I'm looking for a sleeker interpolation. I just noticed that my code isn't commented sorry about that...
airfoil_data = [
1.0000 0.00063
0.9500 0.00403
0.9000 0.00724
0.8000 0.01312
0.7000 0.01832
0.6000 0.02282
0.5000 0.02647
0.4000 0.02902
0.3000 0.03001
0.2500 0.02971
0.2000 0.02869
0.1500 0.02673
0.1000 0.02341
0.0750 0.02100
0.0500 0.01777
0.0250 0.01307
0.0125 0.00947
0.0000 0.00000
0.0125 -0.00947
0.0250 -0.01307
0.0500 -0.01777
0.0750 -0.02100
0.1000 -0.02341
0.1500 -0.02673
0.2000 -0.02869
0.2500 -0.02971
0.3000 -0.03001
0.4000 -0.02902
0.5000 -0.02647
0.6000 -0.02282
0.7000 -0.01832
0.8000 -0.01312
0.9000 -0.00724
0.9500 -0.00403
1.0000 -0.00063];
X = airfoil_data(:,1);
Y = airfoil_data(:,2); % assign the y axis values from the data points.
N = 80; %number of points
for i = 1:(N/2)
theta_i(i) = (pi/N)*(i-1);
xupper(i) = 1-cos(theta_i(i));
end
for i = 1:18
XU(i) = X(i);
YU(i) = Y(i);
end
XU = XU';
YU = YU';
xupper = fliplr(xupper)';
Yupper = interp1(XU,YU,xupper,'spline');
for i = 1:(N/2)
theta_i(i) = (pi/N)*(i-1);
xlower(i) = 1-cos(theta_i(i));
end
for i = 1:17
XL(i) = X(i+18);
YL(i) = Y(i+18);
end
XL = XL';
YL = YL';
xlower = xlower';
Ylower = interp1(XL,YL,xlower,'spline');
X = [xupper;xlower];
Y = [Yupper;Ylower];
%user entered to modify endpoint
X(1) = 1;
X(end) = 1;
Y(1) = Y(1)/N;
Y(end) = Y(end)/N;

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by