What is the best way to loft between multiple 2d sections
12 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a program where I load multiple 2d aerofoil sections from text files. I now want to interpolate between them in order to define an entire wing in terms of x,y,z coordinates. These will eventually be used in determining the mass of the wing from a point z to the tip. I have tried playing with interp1 and interp3 but can't figure out the best way to get the results I want. Should I define eachaerofoil section in terms of x,y,z, and if so how are multiple sections provided to interp, or am I going about this in the wrong way. THanks
3 Commenti
Risposte (2)
Sean de Wolski
il 29 Ott 2012
This sounds like something for TriScatteredInterp, sinc eit does not sound like you have gridded data.
doc triscatteredinterp
Strider
il 26 Mar 2024
I was able to find a solution to my need. I am making use of a custom class object that handles things like giving me the top / bottom surface of an airfoil. This is a method of that class that returns interpolated vertices based on two input airfoils, the distance between them, and the desired location of the new airfoil.
function val = interpolate(obj, dx, vq)
arguments (Input)
obj Base % custom class object array of airfoils
dx (1,1) double % distance between two airfoils to interpolate
vq (1,1) double % distance to interpolate at
end
% must split airfoil into top and bottom surfaces
% my Base object does this and is accessed by a property call
surface = {'Top', 'Bottom'};
for k = 1 : 2
% grab surface
v1 = obj(1).(surface{k}); % top or bottom of first airfoil
v2 = obj(2).(surface{k}); % top or bottom of second airfoil
% cat known points
x = [v1(:,1); v2(:,1)]; % x values for AF1 and AF2
y = [v1(:,2); v2(:,2)]; % y values for AF1 and AF2
% for simplicity, AF1 may be assumed to be at 0.
% AF2 is then at 0 + dx
v = [repelem(0, length(v1))'; repelem(dx, length(v2))'] ;
% our airfoil is a function of x and z
% af = f(x,z)
% query at all old x and new point z.
F = scatteredInterpolant(x, v(:,1), y);
% query new points
af = F(x,[repelem(vq,length(x))]'); % new y values
% cat and sort
a = [x af];
S.(surface{k}) = sortrows(a,1);
end
vert = [S.Top; flip(S.Bottom)]; % new airfoil vertices
end
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!