MATLAB Answers

Aerofoil graph interpolat​ion/extrap​olation

49 views (last 30 days)
Eiso MOuwen
Eiso MOuwen on 11 Jan 2021
Edited: Eiso MOuwen on 12 Jan 2021
I have a bunch of data for a NACA 63-412 aerofoil which I want to use in my software. I have two data sets, one for reynolds number 400000 and one for 5000000. I need to interpolate/extrapolate the data so that I can calculate with other reynolds numbers. The furthest I have gotten now is this, I have drawn two lines from this data and now I need to connect those into i suppose a surface but really wouldn't know how? any help would be greatly appreciated!
Cd1 = [0.0088
0.0089
0.0089
0.009
0.009
0.009
0.009
0.009
0.0091
0.0091
0.0092
0.0093
0.0094
0.0096
0.0098
0.0101
0.0106
0.0116
0.0133];
Cl1= [-0.0053
0.0523
0.1096
0.1675
0.2248
0.2823
0.3392
0.3952
0.452
0.5089
0.5647
0.6206
0.6767
0.7321
0.7858
0.836
0.885
0.928
0.9606];
RE1= [400000
400000
400000
400000
400000
400000
400000
400000
400000
400000
400000
400000
400000
400000
400000
400000
400000
400000
400000];
Cd2 = [0.008
0.008
0.008
0.0081
0.0081
0.0081
0.0081
0.0082
0.0082
0.0083
0.0084
0.0085
0.0087
0.0089
0.0093
0.0101
0.0112
0.0127
0.0141];
Cl2 = [-0.0048
0.053
0.1108
0.1689
0.2267
0.2837
0.3406
0.3982
0.455
0.5117
0.5687
0.6249
0.681
0.7356
0.7879
0.8352
0.8793
0.9172
0.9541];
RE2 = [500000
500000
500000
500000
500000
500000
500000
500000
500000
500000
500000
500000
500000
500000
500000
500000
500000
500000
500000];
figure(1)
hold on
plot3(Cl1,Cd1,RE1);
plot3(Cl2,Cd2,RE2);

  5 Comments

Show 2 older comments
Mathieu NOE
Mathieu NOE on 11 Jan 2021
I believe John is very efficient (and better than me ) to help you
good luck for the future
Eiso MOuwen
Eiso MOuwen on 11 Jan 2021
To be honest, I think you are all generous champs who give out their presious time for free to help a matlab learning 15 year old. I really think you guys are the all time best!
Mathieu NOE
Mathieu NOE on 12 Jan 2021
thanks for the nice comment even though I probably deserve only 1% of it, the rest goes to John

Sign in to comment.

Accepted Answer

John D'Errico
John D'Errico on 11 Jan 2021
Edited: John D'Errico on 11 Jan 2021
You lack sufficient information to construct a meaningful surface, since you have only 2 pieces of information in terms of Reynolds number.
First, plot what you have. A 3-d plot is effectively useless here, and makes it far more difficult to understand what you do have.
plot(Cl1,Cd1,'-or',Cl2,Cd2,'-*b')
legend('RE 400K','RE 500K')
xlabel 'Cl'
ylabel 'Cd'
So we see two curves that are not terribly similar in shape. There is a bit of noise seen. And the abscissa for these two curves are not the same, so you could not just use a tool like interp2 to interpolate. Extrapolating those curves, or for Reynold's numbers that fall (significantly) outside the interval [4e5,5e5] would seem to be a foolish (risky) task, due to the high amount of curvature of the respective curves, and due to the noise in the data.
If you merely wish to predict a point for some other Reynolds number however, you could simply use a spline interpolant, a linear interpolant, or perhaps a smoothing spline for each curve. Then, since you have only two distinct Reynolds numbers and thus only two distinct curves, just use linear interpolation between the two. For example, if you have the curve fitting toolbox, I might do this:
CF1 = fit(Cl1,Cd1,'smoothingspline');
CF2 = fit(Cl2,Cd2,'smoothingspline');
CFinterp = @(Cl,Re) (5e5 - Re)/(5e5-4e5)*CF1(Cl) + (Re - 4e5)/(5e5-4e5)*CF2(Cl);
Cl = linspace(0,1,50);
Reinterp = 4.5e5;
hold on
plot(Cl,CFinterp(Cl,Reinterp),'g-')
legend('RE 400K','RE 500K','RE 450K')
I hard coded the Reynolds numbers in the interpolant there, but it is easy enough to fix that.

  4 Comments

Show 1 older comment
John D'Errico
John D'Errico on 11 Jan 2021
With only two curves, thus essentialy two pieces of information, you cannot do much more than the linear interpolation between then that I did.
However, with more curves, you can now use a better interpolation scheme. One issue is they are not all at the same set of points, so a tool like interp2 is still inappropriate. However, if you had multiple such curves, you might now set it up as a scattereed interpolation, perhaps using a tool like scatteredInterpolant. One problem you would need to consider is that your data has been rounded.
That is, we see this:
Cd1 = [0.0088
0.0089
0.0089
0.009
0.009
0.009
0.009
0.009
0.0091
0.0091
0.0092
0.0093
0.0094
0.0096
0.0098
0.0101
0.0106
0.0116
0.0133];
The result is, we see information has been lost because the numbers have been rounded to 4 decimal places. This is in fact probably a large part of what I viewed as noise in my answer. So the first problem is to avoid rounding your data.
Years ago, I wrote a little toy to unround such data. It finds the best approximate set of values in a vector that are consistent with rounding your data, yet form a smooth sequence. I'll attach unround to this comment. It uses quadprog as I recall, from the optimization toolbox.
Cd2hat = unround(round(Cd2*10000))/10000
Cd2hat =
0.00799562511358732
0.00801375007622656
0.00803187503888049
0.00805000000151423
0.00806812496391403
0.00808899994112061
0.00811537494835355
0.00815000000087096
0.00819562511387439
0.00825978140711786
0.0083500000003701
0.00847381201377941
0.0086500000000361
0.00889734651195069
0.00934999999997362
0.0101421089145642
0.0112499999999845
0.0126500000000143
0.0140500416872856
>> Cd1hat = unround(round(Cd1*10000))/10000
Cd1hat =
0.00885
0.00888733905579094
0.00892167381973867
0.00895
0.00896931330473172
0.00898453765121487
0.00900059695673051
0.00902241513855969
0.00905491611398346
0.00910302380028289
0.0091716621147461
0.00926575497466125
0.00939022629731648
0.00955
0.00975
0.01006
0.01064
0.01165
0.01325
plot(Cl1,Cd1hat,'-or',Cl2,Cd2hat,'-*b')
xlabel 'Cl'
ylabel 'Cdhat'
That has now dramatically improved your data. (I should probably post unround.m on the File Exchange someday. I don't think I ever did.) It suggests that your data is not in fact noisy, only that you sloppily allowed it to be rounded to 4 digits.
If you now had several such curves, now I might try building a scatteredInterpolant for Cd, as a function of the parameters Cl and Re. But before you could do that, you need the more accurate values for Cl, otherwise any interpolation will fail to perform well. The nice thing about scatteredInterpolant is it will allow you to create that surface as a function of the two variables.
Eiso MOuwen
Eiso MOuwen on 11 Jan 2021
Wow man, I really apologize for the duplicate question I hoped it would make the question a bit clearer. I really appreciate how you are helping me and I am now gathering the airfoil data and I will post it on here asap!
Eiso MOuwen
Eiso MOuwen on 12 Jan 2021
Hello! I'm back. With more data this time! I managed to gather (smooth ish) data for RE = 100.000 200.000 500.000 1.000.000. I attached an excel file if needed and further more I wrote this code to plot all the lines into one graph. I really hope you guys can still help me. My hat goes off to you!
ClRE01e6 = [-0.2581
-0.2267
-0.1977
-0.1667
-0.1415
-0.1144
-0.0882
-0.0597
-0.0344
-0.0073
0.0176
0.0463
0.0725
0.1018
0.1269
0.1558
0.1813
0.2092
0.2351
0.2622
0.2876
0.3154
0.3399
0.3672
0.3923
0.4185
0.4434
0.4699
0.4939
0.5195
0.5438
0.5695
0.5940
0.6222
0.6518
0.6880
0.7192
0.7467
0.7742
0.8012
0.8279
0.8527
0.8763
0.8763
0.9189
0.9359
0.9469
0.9566
0.9673];
CdRE01e6 = [0.01951
0.01870
0.01799
0.01711
0.01578
0.01487
0.01474
0.01473
0.01484
0.01497
0.01509
0.01510
0.01510
0.01505
0.01507
0.01502
0.01504
0.01500
0.01503
0.01500
0.01504
0.01503
0.01508
0.01508
0.01514
0.01514
0.01521
0.01523
0.01529
0.01529
0.01535
0.01534
0.01539
0.01536
0.01542
0.01543
0.01553
0.01568
0.01578
0.01585
0.01590
0.01600
0.01611
0.01611
0.01676
0.01747
0.01877
0.02034
0.02189];
ClRE02e6 = [-0.2272
-0.1974
-0.1635
-0.1343
-0.1094
-0.0823
-0.0533
-0.0263
0.0014
0.0270
0.0536
0.0784
0.1047
0.1309
0.1578
0.1836
0.2115
0.2370
0.2644
0.2907
0.3173
0.3437
0.3701
0.3955
0.4232
0.4470
0.4734
0.4986
0.5235
0.5467
0.5720
0.5944
0.6182
0.6401
0.6658
0.6989
0.7376
0.7689
0.7973
0.8245
0.8521
0.8794
0.9058
0.9307
0.9534
0.9692
0.9740
0.9777
0.9900];
CdRE02e6 = [0.01613
0.01552
0.01458
0.01367
0.01142
0.01120
0.01116
0.01119
0.01123
0.01137
0.01152
0.01166
0.01174
0.01178
0.01177
0.01179
0.01177
0.01179
0.01177
0.01180
0.01178
0.01182
0.01181
0.01185
0.01186
0.01190
0.01190
0.01195
0.01194
0.01196
0.01194
0.01194
0.01190
0.01183
0.01175
0.01164
0.01155
0.01153
0.01153
0.01151
0.01156
0.01167
0.01183
0.01205
0.01238
0.01321
0.01510
0.01732
0.01876];
ClRE05e6 = [-0.2159
-0.1892
-0.1622
-0.1351
-0.1080
-0.0819
-0.0559
-0.0285
-0.0006
0.0276
0.0557
0.0841
0.1120
0.1401
0.1683
0.1965
0.2246
0.2530
0.2814
0.3096
0.3381
0.3661
0.3944
0.4225
0.4506
0.4787
0.5065
0.5347
0.5622
0.5902
0.6174
0.6448
0.6719
0.6987
0.7257
0.7512
0.7771
0.8030
0.8284
0.8533
0.8769
0.8975
0.9139
0.9267
0.9431
0.9638
0.9848
1.0072
1.0298];
CdRE05e6=[0.01099
0.01067
0.01032
0.00998
0.00952
0.00864
0.00774
0.00737
0.00726
0.00718
0.00716
0.00714
0.00712
0.00710
0.00713
0.00714
0.00716
0.00718
0.00722
0.00722
0.00727
0.00728
0.00731
0.00734
0.00738
0.00741
0.00746
0.00751
0.00757
0.00761
0.00767
0.00773
0.00778
0.00784
0.00792
0.00801
0.00813
0.00825
0.00838
0.00857
0.00879
0.00921
0.00995
0.01089
0.01183
0.01286
0.01374
0.01442
0.01503];
ClRE1e6 = [-0.2228
-0.1954
-0.1674
-0.1395
-0.1114
-0.0835
-0.0557
-0.0282
-0.0006
0.0276
0.0561
0.0847
0.1133
0.1421
0.1705
0.1993
0.2277
0.2566
0.2566
0.3139
0.3423
0.3711
0.3711
0.4282
0.4566
0.4852
0.5135
0.5419
0.5702
0.5981
0.5981
0.6539
0.6815
0.7088
0.7361
0.7633
0.7902
0.8168
0.8410
0.8630
0.8838
0.9050
0.9263
0.9481
0.9706
0.9939
1.0171
1.0390
1.0615];
CdRE1e6 = [0.00909
0.00874
0.00856
0.00834
0.00813
0.00784
0.00742
0.00684
0.00626
0.00596
0.00582
0.00574
0.00570
0.00567
0.00564
0.00561
0.00562
0.00559
0.00559
0.00562
0.00565
0.00566
0.00566
0.00572
0.00579
0.00581
0.00587
0.00591
0.00596
0.00603
0.00603
0.00619
0.00629
0.00642
0.00655
0.00669
0.00685
0.00706
0.00747
0.00815
0.00893
0.00968
0.01037
0.01098
0.01149
0.01191
0.01226
0.01267
0.01293];
figure
hold on;
plot(ClRE01e6,CdRE01e6);
plot(ClRE02e6, CdRE02e6);
plot(ClRE05e6, CdRE05e6);
plot(ClRE1e6, CdRE1e6);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!