Matlab:插值两个不同的数据集以读取绘制线之间的图形

时间:2015-07-10 16:58:12

标签: matlab graph interpolation

我正在研究我的论文,我试图读出已经数字化的经验图。当然,这可以通过数据光标来完成。但是我需要自动化这个过程,因为图中的数据将以迭代的方式用于其他一些方程。

此图表包含不同的数据集。 X轴具有恒定范围,而Y值取决于翼型的厚度。因此,与具有35%厚度的翼型相比,30%厚度具有不同的数据集。

现在我知道如何用书面代码阅读图表。但是,当我计算出的翼型厚度为30%或%35时,我才知道它,因为我有数值数据集。

有时,我计算出一个30%到35%之间的翼型厚度,对于这种情况,我没有具体的数据集,请参阅下面链接中红色和蓝色线之间的空格:

蓝线对应30%厚度数据集,红线对应35%厚度数据集。

http://i.imgur.com/YUs6RYO.jpg

那么如何插入这个三维问题呢?我真的不需要额外的数据集,比如说厚度为32%,只需要Y值即可。

(例如,假设我计算了32%的厚度,我需要对应于X = 4的Y值)。还计算X,使其为每次迭代的常数。此外,不一定要保存插值。

以下是30%的数据集:

-0.003287690575036084 0.8053924336902605 0.043171086183339424 0.8050602124925952 0.08963141038123656 0.8049872858882297 0.1360917345791337 0.804914359283864 0.18255205877703085 0.8048414326794985 0.22901393041444962 0.8050278006684327 0.2754727071728251 0.8046955794707673 0.32193303137072227 0.8046226528664018 0.3683933555686194 0.8045497262620362 0.41485367976651655 0.8044767996576706 0.4613140039644137 0.8044038730533051 0.5077928974365709 0.807442481568537 0.554253221634468 0.8073695549641714 0.6007135458323651 0.8072966283598059 0.6471738700302623 0.8072237017554403 0.6936341942281594 0.8071507751510747 0.7400945184260566 0.8070778485467092 0.7865548426239537 0.8070049219423436 0.8330151668218508 0.806931995337978 0.879475491019748 0.8068590687336125 0.9259358152176451 0.8067861421292469 0.9723914970969771 0.805935331744982 1.0188580110529613 0.8068995835138155 1.0653616635574645 0.8140869055218445 1.1118746006990976 0.8228299950896718 1.1556231476667052 0.8317626359505925 1.2029940294916959 0.8452458101065382 1.2514872249891795 0.8614276158935545 1.2980594290644916 0.8801016883847644 1.3428742623455985 0.8991957518202068 1.3834632352399387 0.9179287180691845 1.4240523769458633 0.9366899710010677 1.4670993309116496 0.9544431793698794 1.5108094611858853 0.9771597061348987 1.5560453105579366 0.996026813137967 1.599090576407881 1.0134971546777245 1.6396876522582617 1.033587881706163 1.6802729112977504 1.0516985409312212 1.721977391140349 1.0686193915565696 1.759264865239414 1.0885371057408935 1.8027351648960062 1.106453713901426 1.8475635031038473 1.127810711969303 1.8899200176903397 1.1478279599191006 1.9329627513665215 1.1648740012152765 1.9743393991126437 1.185840399970377 2.007525709721886 1.1997514536139606 2.04520726180335 1.2178772782578813 2.0882668766379497 1.2377519878446006 2.12885563007723 1.2564481814058013 2.169441108571778 1.2745956133186365 2.214272434744659 1.2964532856739395 2.254879183498814 1.3181648396328591 2.2979393047681658 1.3381244092682947 2.3385460028788447 1.3598274772223429 2.3773808546019755 1.3795249530614826 2.416215706325106 1.3992224289006225 2.4568104188133093 1.418917142368385 2.501617655573127 1.4367383050730829 2.548189395416583 1.4553345891863025 2.593000852466006 1.4738629189636363 2.641319257635704 1.490245364991704 2.6840014566601855 1.5058571953458966 2.7334538841264777 1.5205811105296216 2.780967627778736 1.534832690900812 2.8274836597994124 1.5440943696552392 2.875656557422194 1.5529459809557538 2.9205079866431563 1.5613212541975945 2.9670069968290953 1.567730692425724 3.013495174938382 1.5723250685007546 3.0599771632895827 1.5758822662025862 3.106451414443174 1.5781429909379188 3.1529287604758096 1.580922304859851 3.1994030116294008 1.5831830295951836 3.2458849999806016 1.5867402272970152 3.2923499664970635 1.587445184472549 3.338818027892569 1.5886687308346825 3.38527216233238 1.5875586258571177 3.4317108223769734 1.583855574946555 3.4781726940143933 1.5840419429354893 3.5246314707727677 1.5837097217378238 3.5710763205754494 1.5810438492004604 3.6175258126966945 1.579155860442996 3.6639675676203325 1.5759713987190331 3.7131639859552887 1.5709675339726639 3.7568433402699988 1.5683060023046078 3.8032742631169842 1.563306478427546 3.8497082808430134 1.558825543737084 3.896136108810956 1.5533074306734227 3.94256548421842 1.5480486122030612 3.988994859625884 1.5427897937326998 4.035421140154305 1.5370123860757385 4.081836588606075 1.529419916265679 4.128252037057845 1.5218274464556192 4.174667485509614 1.5142349766455596 4.221086028840427 1.5071610960220996 4.264731118422872 1.4987580412166908 4.31392156806253 1.4927540401818795 4.360340111393343 1.4856801595584195 4.406757107284634 1.4783469843416595 4.453175650615448 1.4712731037181994 4.499600383704346 1.4652364014679387 4.546023569353724 1.458940404624378 4.592451397321666 1.4534222915607167 4.638882320168652 1.4484227676836547 4.685311695576116 1.4431639492132935 4.73173952354406 1.437645836149632 4.778173541270088 1.43316490145917 4.824602916677553 1.4279060829888084 4.871050861359277 1.4257587996380445 4.917486426524827 1.4215371595408821 4.963921991690379 1.41731551944372 5.010357556855929 1.4130938793465577 5.056800859219089 1.4101687122158943 5.103258088537942 1.409577196424929 5.149710675538231 1.4082077968540645 5.188422196331486 1.407239493607210

和35%案例

0.006168966650546004 0.8044498654339525 0.05251074466351513 0.8041649550926027 0.09885097179873537 0.8041405922130573 0.1451911989339556 0.8041162293335119 0.19153142606917584 0.8040918664539666 0.2378701023266474 0.8043280510362257 0.28421188033961653 0.8040431406948759 0.33055210747483676 0.8040187778153305 0.376892334610057 0.8039944149357852 0.42323256174527746 0.8039700520562398 0.4695727888804977 0.8039456891766945 0.5158944054827321 0.8070478958388025 0.5622346326179524 0.8070235329592572 0.6085748597531726 0.8069991700797119 0.6549150868883928 0.8069748072001666 0.7012553140236131 0.8069504443206211 0.7475955411588333 0.8069260814410758 0.7939357682940535 0.8069017185615305 0.8402759954292742 0.8068773556819852 0.8866162225644945 0.8068529928024398 0.9329564496997147 0.8068286299228944 0.9793013294681812 0.8060226246579357 1.0256369039701552 0.8067799041638037 1.071932155650659 0.8143114176765875 1.1187799629176767 0.8216937568912026 1.1617476956110715 0.8321674748214614 1.20883433805141 0.8457655870362711 1.2570081679490785 0.8620765348918837 1.3032362666230588 0.8808897535008002 1.347706558159841 0.9001231394982395 1.3879672317285157 0.9188329081527227 1.4282258750572274 0.9378837571208412 1.472706881749366 0.9553169970185403 1.5124760398627677 0.9779636470492524 1.551459748890828 0.9949497419759024 1.5941903785600746 1.0115548900587519 1.6344423390155782 1.0317284617259186 1.6747003901909685 1.0508787924521803 1.71742594426031 1.0683366413191173 1.7594253491698706 1.0898309763652727 1.8021487038125867 1.1076583289053143 1.8423992261814504 1.1280734991279724 1.8826578695101626 1.1471243480960909 1.9271326726913052 1.1655997778410079 1.972291271970799 1.1871540357272572 2.00704079571732 1.202828964772921 2.0444053954250387 1.2215082798279724 2.0871182604946177 1.2410978806551278 2.127378223479305 1.2599270274193834 2.167638930885312 1.2786311114019728 2.2120949825445826 1.3002567968214347 2.2565756226656166 1.3177516206646513 2.2968395953742293 1.335907133809478 2.3370983232962734 1.3549437710978616 2.381577849605106 1.3726257153909196 2.427805638103535 1.391491043492197 2.4778943367576924 1.4104846150844144 2.5171966806686945 1.42505456449785 2.5645930555508722 1.44222572502541 2.6111147353827078 1.458057391232824 2.6590291034329954 1.4716178473302413 2.7036702332173843 1.4790013466819776 2.751618055916255 1.4869414218176131 2.801789183722762 1.492086895814924 2.8414799006551674 1.4970182761743256 2.890545684656986 1.5025011808872442 2.936856445114978 1.5074272197819834 2.9831823266310216 1.5098129209241293 3.0294888221752045 1.5154554653388308 3.079683755955156 1.5166015357974434 3.1221351571351703 1.521138783739438 3.168472282514893 1.5216355157835015 3.2147985517503748 1.5239560800601961 3.261134126252348 1.5247133595660642 3.3074743533875686 1.524688996686519 3.353805275256295 1.5262279185778003 3.4001361971250232 1.5277668404690816 3.4464841786489866 1.5264397402805139 3.492839914561696 1.5238099027829242 3.539192548718906 1.5217011602089432 3.585549835509364 1.5188107752495488 3.631899367911078 1.5172231275991768 3.6810223128356383 1.5131029972913028 3.724610839736495 1.5119634526039971 3.770966575649203 1.5093336151064072 3.8173285150729073 1.5056615877615995 3.8636904544966115 1.5019895604167919 3.909506484952725 1.4973500753909907 3.9580866226651925 1.4917413924785146 4.002793332422961 1.4881074563025198 4.049172331501902 1.4815694068778633 4.0955466779475955 1.4758129998386198 4.141921024393291 1.4700565927993767 4.188298472594484 1.4637790908365245 4.234679022551173 1.4569804939500635 4.28106267426336 1.4496608021399933 4.327446325975549 1.4423411103299233 4.373831528565486 1.434760871058049 4.420213629399925 1.4277017267097833 4.4665972811121115 1.4203820348997134 4.512984034579798 1.4125412481660344 4.559364584536487 1.4057426512795734 4.606304779806543 1.3976038059838376 4.652133438838613 1.390842720197629 4.69851553967305 1.3837835758493635 4.7448991913852385 1.3764638840392935 4.794049165893421 1.3678027836828277 4.826065929248319 1.3644360657570844

第一列是X,第二列是Y

我希望我足够清楚。如果您需要更多信息,请告诉我

非常感谢!

我知道两个数据集都应该用interp1进行插值,以获得一个大小相同且X轴范围相同的数据集。

1 个答案:

答案 0 :(得分:0)

这样的事情应该有效:

% Load the data however you want.
data_30 = load('data_30.txt');
data_35 = load('data_35.txt');
x30 = data_30(:,1);
y30 = data_30(:,2);
x35 = data_35(:,1);
y35 = data_35(:,2);

% thicknesses for each dataset
t30 = 30;
t35 = 35;

% Values that you want to interpolate to
xi = 4;
ti = 32;

% Interpolate in x first
y30i = interp1(x30, y30, xi)
y35i = interp1(x35, y35, xi)

% ... then interpolate in t
yi = interp1([t30  t35], [y30i  y35i], ti)

% ... or interpolate everything simultaneously
yi = interp1([t30  t35], [interp1(x30, y30, xi)  interp1(x35, y35, xi)], ti)