Sorting of points in 2D
Ältere Kommentare anzeigen
Dear All,
I face issue in arranging the airfoil coordinates coming from a CAD program. The coordinates are arranged from minumum x value to maximum x value. But I require to arrange the points starting from Trailing Edge ( Max X coordinate) and then proceed on top side all the way to Leading Edge ( Minimum X coordinate) and then again proceed in the bottom side and terminate in the Trailing Edge.
The input.txt ( required input file to be sorted)
Output.txt (the coordinates sorted manually).
I have several airfoil coordinates of similar nature, so a matlab function could help me out doing the job manually everytime.
Any help is really appreciated.
Thanks in Advance,
K Vijay Anand
3 Kommentare
Ameer Hamza
am 17 Okt. 2020
Can you create a small input and output file? Maybe with a maximum of 20 lines. That will help in understanding the pattern.
KSSV
am 17 Okt. 2020
One way is to use the below rocedure:
Vijay Anand
am 17 Okt. 2020
Bearbeitet: Vijay Anand
am 17 Okt. 2020
Akzeptierte Antwort
Weitere Antworten (1)
Vijay Anand
am 18 Okt. 2020
Bearbeitet: Vijay Anand
am 18 Okt. 2020
0 Stimmen
2 Kommentare
Steven Lord
am 18 Okt. 2020
Consider using the movmean function included in MATLAB.
Stephen23
am 19 Okt. 2020
I did some more experimentation and got better results replacing the moving average with a polynomial fitted to the data. First I tried polyfit, but quickly realized that the end points need to be specified. Luckily this FEX submission
allows constraints to be specified, including points that the curve has to pass through:
pts = Inp{[1,end],:}; % polynomial must pass through the leading & trailing edges
pwr = mmpolyfit(Inp.x,Inp.y, 5, 'Point',pts) % fit order 5 polynomial
tmp = polyval(pwr, Inp.x); % replaces TMP in the original answer
And checking the fit:
plot(Inp.x,Inp.y,'-*', Inp.x,tmp,'-+')

Kategorien
Mehr zu Airfoil tools finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



