Matlab 中保持形状的夹紧端插值

发布于 2024-12-31 21:34:29 字数 519 浏览 2 评论 0原文

我正在 Matlab 中寻找一种算法,它可以保留数据的形状,同时允许我夹紧末端。我试图从弦线、前缘角度、后缘角度和最大外倾角的位置生成外倾角线。请参阅翼型术语了解定义。使用该信息,我想在前缘和后缘之间生成任意数量的点,这些点在弦上均匀分布。

以下是我迄今为止评估过的算法:

“pchip”似乎不允许夹紧,除非我在搜索时反复输入错误,但确实提供了适当的形状保留。

“样条线”不保持形状。使用 3 点数据,中间数据点为最大外倾角且两端被夹紧,样条曲线不能保证中间数据为生成曲线上的最高点。有关该行为的示例,请参阅此答案

'csape' 提供了足够的最终条件,但我不能确定它是否足以保持形状。

I'm looking for an algorithm in Matlab that can preserve the shape of my data while allowing me to clamp the ends. I'm trying to generate the camber line from the chord line, the leading edge angle, trailing edge angle, and the position of the max camber. See Airfoil terminology for definitions. Using that information, I want to generate any number of points between the leading edge and the trailing edge, evenly spaced on the chord.

Here are the algorithms I've evaluated so far:

'pchip' doesn't seem to allow clamping, unless I mistyped repeatedly when searching, but does offer proper shape preservation.

'spline' doesn't preserve shape. Using 3 points of data, the middle data point being the max camber and both ends clamped, a spline can't guarantee the middle data to be the highest point on the generated curve. See this answer for an example of that behavior.

'csape' provides adequate end conditions, but I cannot be sure it is adequately shape preserving.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青衫儰鉨ミ守葔 2025-01-07 21:34:29

如果您的数据只有这三个点,您可以分两个阶段进行,一个阶段用于上半场,下一个阶段用于下半场。您可以利用这样一个事实:在距弦线最远的点(中点),线的梯度为零。

将每条线生成为两点之间的样条线,每一端均处于指定角度。

X = [0 5 10];
Y = [0 3 2];
start_slope = 0;
end_slope = -0.7;

xx1 = linspace(X(1), X(2), 100);
xx2 = linspace(X(2), X(3), 100);
yy1 = spline(X(1:2), [start_slope, Y(1:2), 0], xx1);
yy2 = spline(X(2:3), [0, Y(2:3), end_slope], xx2); 

plot([xx1, xx2],  [yy1, yy2]);
hold on
scatter(X, Y, 'filled')

在此处输入图像描述

If your data will only ever have those three points, you can do it in two stages, one for the first half, and the next for the second half. You can use the fact that at the point furthest from the chord line (the middle point), the gradient of the line will be zero.

Generate each line as a spline between two points, with each end at the designated angle.

X = [0 5 10];
Y = [0 3 2];
start_slope = 0;
end_slope = -0.7;

xx1 = linspace(X(1), X(2), 100);
xx2 = linspace(X(2), X(3), 100);
yy1 = spline(X(1:2), [start_slope, Y(1:2), 0], xx1);
yy2 = spline(X(2:3), [0, Y(2:3), end_slope], xx2); 

plot([xx1, xx2],  [yy1, yy2]);
hold on
scatter(X, Y, 'filled')

enter image description here

小耗子 2025-01-07 21:34:29

我已在数学堆栈交换上发布了我的问题,并得到了以下答案。本质上,我可以使用 Fritsch-Carlson 方案来计算/设置数据点的斜率。如果我想将斜率设置为中点,我会将间隔分为两部分,就像 Bill Cheatham 建议的那样。

我还可以包装我的数据并使用 pchip 或样条曲线来处理适用的点,而不是重新实现整个方法。

I've posted my question on the mathematics stack exchange and got the following answer. Essentially, I can use the Fritsch-Carlson scheme to calculate/set slopes at my data points. If I want to set the slope to my middle point, I will separate my interval in two parts, like Bill Cheatham suggests.

I can also wrap my data and use pchip or a spline for the points that apply instead of reimplementing the whole method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文