# B-spline fit of airfoil coordinates

 Register Blogs Members List Search Today's Posts Mark Forums Read

 September 3, 2021, 11:55 B-spline fit of airfoil coordinates #1 New Member   Marco Zanichelli Join Date: Jun 2021 Posts: 6 Rep Power: 3 Hello everybody, I am an aerospace Engineer, I am currently working in an airfoil optimization project. I want to create an airfoil parametrization starting from a RAE2822 of which I know the coordinates. At the beginning I was trying to get a unique B-spline representation for the whole airfoil curve, i.e. to find a unique curve that fits the airfoil curve. I have not been able to do so (does anybody have an idea?) . Anyway, I found the spap2 function of Matlab and I've been using it to find the B-spline best-fit to the coordinates I have, keeping separate the lower and upper part of the airfoil. Trying some different knot sequences and found some that seem promising, but I am getting a weird behaviour at the Leading Edge. The B-spline curves follow really accurately the original curve but show a "pointy" behaviour. I am now attaching my matlab script. Code: ```filename = 'RAE2822.txt'; % attached here coords = readtable(filename); x_0 = coords.Var1; y_0 = coords.Var2; % separation of upper and lower parts of the airfoil xaxis = sort(x_0(1:65)); x_1 = x_0(1:65); y_1 = y_0(1:65); x_2 = [0; x_0(66:end)]; y_2 = y_0(65:end); % plot of the original coordinates plot(x_1, y_1, x_2, y_2); hold on; % definition of the knot sequence x = [0, 0.025, 0.05, 0.2, 0.55, 1]; degree = 3 %b - spline degree knots = augknt(x,degree+1); %weights w1 = ones(size(x_1)); % w1(end) = 1000; w2 = ones(size(x_2)); w2(1) = 1000; %least squares b-spline fit of the suction side SS BS_SS = spap2(knots, degree+1, x_1, y_1,w1); fnplt(BS_SS); %least squares b-spline fit of the pressure side PS BS_PS = spap2(knots, degree+1, x_2, y_2, w2); fnplt(BS_PS); axis equal xlim([-0.01, 0.05]) % comment if you want to see the whole parametrization. Here you can see the problem``` I am guessing this problem comes from the large derivative I have at the beginning of the curve, but I am not really sure about that. Can somebody help ?

 September 30, 2021, 07:43 #2 Member   Chrowale Join Date: Sep 2021 Location: Bandung, Indonesia Posts: 43 Rep Power: 3 Have you tried to use camber line as your line of reference and not coordinates? It will better to resemble the airfoil curves but for exchange of added variables of thickness for each point in the curve.

 Tags #airfoil, #bspline, #fit, #parametrization