Making Smoother the Curve fit to Airfoil data using cscvn function

8 次查看(过去 30 天)
Hello I am using the following code to fit a curve to the following data
% Get the coordinates of the airfoil - airfoiltools.com - http://airfoiltools.com/airfoil/details?airfoil=goe802-il
GOE802_DiscretePoints = readtable('GOE802_DiscretePoints.csv', 'NumHeaderLines', 1);
GOE802_DiscretePoints = GOE802_DiscretePoints{:, :};
% Get the x and y coordinates of the airfoil for the upper and lower surfaces
x_lower_original = GOE802_DiscretePoints(:, 1);
y_lower_original = GOE802_DiscretePoints(:, 2);
x_upper_original = GOE802_DiscretePoints(:, 3);
y_upper_original = GOE802_DiscretePoints(:, 4);
x_all = [x_lower_original; flip(x_upper_original)];
y_all = [y_lower_original; flip(y_upper_original)];
x = x_all';
y = y_all';
select = [1:17, 17, 19:34]; % Repeating trailing point to make a sharp corner there
x = x(select);
y = y(select);
curve = cscvn( [x; y] );
fnplt(curve)
axis equal
How do I make it smoother for example I would like to break this boundary into N points where N>>n, say N = 100,000.
This is especially needed at the front tip where it should be smooth but is currently sharp.
  1 个评论
atharva aalok
atharva aalok 2022-8-28
编辑:atharva aalok 2022-8-29
If Mr. John D Errico you are seeing this:
I am also trying to use your Interparc file from file exchange:
% Get the coordinates of the airfoil - airfoiltools.com - http://airfoiltools.com/airfoil/details?airfoil=goe802-il
GOE802_DiscretePoints = readtable('GOE802_DiscretePoints.csv', 'NumHeaderLines', 1);
GOE802_DiscretePoints = GOE802_DiscretePoints{:, :};
% Get the x and y coordinates of the airfoil for the upper and lower surfaces
x_lower_original = GOE802_DiscretePoints(:, 1);
y_lower_original = GOE802_DiscretePoints(:, 2);
x_upper_original = GOE802_DiscretePoints(:, 3);
y_upper_original = GOE802_DiscretePoints(:, 4);
x_all = [x_lower_original; flip(x_upper_original)];
y_all = [y_lower_original; flip(y_upper_original)];
x = x_all';
y = y_all';
select = [1:17, 19:34]; % Repeating trailing point to make a sharp corner there
x = x(select);
y = y(select);
xyint = interparc(5000,x,y,'spline');
figure(10);
axis equal
grid on
hold on
plot(x,y,'bo',xyint(:,1),xyint(:,2),'r-');
How do I get a sharp corner at the end?

请先登录,再进行评论。

采纳的回答

John D'Errico
John D'Errico 2022-8-28
I saw your question. You don't need to direct a question at me.
However, it appears you are asking how to get a sharp corner at the END? Where, at x==1? You explicitly put that point in the middle of your curve, then used a spline to interpolate it.
There might appear to be two corners in that airfoil. One at x==1, and another between x=0.0125 and 0.025. There clearly is not a corner at x==0.
But at x == 1, the curve is not even continuous, with two distinct y values at x==1.
GOE802_DiscretePoints = readtable('GOE802_DiscretePoints.csv', 'NumHeaderLines', 1);
GOE802_DiscretePoints = GOE802_DiscretePoints{:, :};
x_all = [flip(GOE802_DiscretePoints(:, 3));GOE802_DiscretePoints(:, 1)];
y_all = [flip(GOE802_DiscretePoints(:,4));GOE802_DiscretePoints(:, 2)];
inddrop = @(n,ind) setdiff(1:n,ind);
xy = interparc(1000,x_all(inddrop(34,18)),y_all(inddrop(34,18)),'spline');
plot(xy(:,1),xy(:,2))
So what sharp corner might you have thought should be there?
  3 个评论
atharva aalok
atharva aalok 2022-8-29
I think I could go with the following solution:
Use the interparc function to make a finer discretization.
Fit a smoothing spline function to it.
Calculate at equally spaced x vector values.
Can this be done directly using the cscvn function by any chance?
atharva aalok
atharva aalok 2022-8-30
After thiking about my above comment, I think its a horrible idea because then near the Leading Edge (x == 0) there would be way lesser points discretizing the curve since the slop is higher at that point than at other locations on the airfoil. Whereas, it should be the other way there should be way more points at x == 0 because of the highly curved nature (Lower radius of curvature).

请先登录,再进行评论。

更多回答(0 个)

类别

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