How to smooth an airfoil given through a set of points ?

조회 수: 40 (최근 30일)
Giuseppe
Giuseppe 2019년 10월 22일
댓글: Clément Carré 2022년 4월 15일
Hi everyone!
I've written a simple code to study an airfoil geometry. The problem arises when I try to zoom in the leading edge; infact the result is a curve not smooth:untitled.jpg
I've tryed to use interp1 but I've had some diffuculties. The code is the following one:
clc; close all; clear all;
%Import points
A = importdata ('DAE-21.txt'); %here we have 80 points starting from trailing edge, counter-clockwise direction, and returning to t.e.
x = A (:,1);
y = A (:,2);
do = importdata ('DAE-21_dorsoDraw.txt');
ve = importdata ('DAE-21_ventreDraw.txt');
n = length(do);
yv=interp1(ve(:,1),ve(:,2),do(:,1));
for i=1:n-1
X(i) = (do(i,1)+ ve(i,1))/2;
Y(i) = (do(i,2)+ ve(i,2))/2;
end
%mean line
lm=(yv+do(:,2))/2;
figure (1)
plot (x,y,'o')
axis equal
axis ([-0.05 1.05 -0.1 0.2])
xlabel ('x/c')
ylabel ('z/c')
grid on
%Disegno del profilo: con la linea media
figure (2)
plot(x,y,'k',do(:,1),lm,'k--','LineWidth',1.2);
axis equal
axis ([-0.05 1.05 -0.1 0.2])
xlabel ('x/c')
ylabel ('z/c')
grid on
% LEADING EDGE ZOOM
figure (3)
plot (x,y,'k','LineWidth',1.2)
axis equal
axis ([-0.01 0.05 -0.03 0.05])
xlabel ('x/c')
ylabel ('z/c')
grid on
%trailing edge zoom
figure (4)
plot (x,y,'k','LineWidth',1.2)
axis equal
axis ([0.9 1.05 -0.03 0.04])
xlabel ('x/c')
ylabel ('z/c')
grid on
Whats commands can I use to smooth the airfoils or at least the leading edge ?

채택된 답변

John D'Errico
John D'Errico 2019년 10월 22일
편집: John D'Errico 2019년 10월 22일
You cannot fit a spline directly to data of that form. (I don't have your data, so I cannot give an example using it.) But for example:
theta = linspace(-pi/2,pi/2,15)';
x = cos(theta);
y = sin(theta);
what happens when we just use a spline, or interp1, for that matter on the (x,y) curve? It fails, and fails, miserably! I'll even use the method David suggested.
airfoil=fit(x,y,'smoothingspline');
plot(airfoil)
Why did it fail so badly? Becua the (x,y) pairs here are not in the form of a single valued function, that is, y(x). So for ANY x, we need to see a single value for y. But in your airfoil, you don't have that. You have a relationship that is essentially multi-valued.
So what happens is interp1 internally SORTS your data on x, then assumes y is a single valued function of x. NOT TRUE FOR YOU. And that will cause it to fail in unfortunate ways.
The common answer, IF you have a parametric form, is to use that. So, if we were to fit x(theta) and y(theta), so both functions of a third parameter that drives both x and y, then we can make it work. But you won't have that, or at least, you probably won't have it.
So what can you do? You can download my interparc function from the File Exchange.
xyint = interparc(100,x,y,'spline');
plot(x,y,'bo',xyint(:,1),xyint(:,2),'r-')
If you have the curve fitting toolbox, you can use cscvn, which is able to handle a set of points that lie along a completely general path in the plane like this.
fnplt(cscvn([x,y ]'))
  댓글 수: 5
Giuseppe
Giuseppe 2019년 10월 26일
Excuse me for further question: Is it possible to increase the number of points only in a portion of my closed curve ?
p.s. I'm interested to smooth very well the zones with high curvature!
Thanks.
Clément Carré
Clément Carré 2022년 4월 15일
Hello Giuseppe, have you found a way to increase the number of points in the portions with high curvature ?
Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

David Hill
David Hill 2019년 10월 22일
airfoil=fit(x,y,'smoothingspline');
plot(airfoil);
  댓글 수: 2
John D'Errico
John D'Errico 2019년 10월 22일
David, I explain why that fails in my answer.
David Hill
David Hill 2019년 10월 22일
Thanks.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by