MATLAB中的曲线光顺

cetgtptt  于 2023-08-06  发布在  Matlab
关注(0)|答案(1)|浏览(166)


的数据
如何在MATLAB中平滑此曲线?我已经尝试了所有选项的smoothdata(),但它们通常会导致一条直线。与fit()相同。我怎样才能摆脱颠簸?

idfiyjo8

idfiyjo81#

为什么不使用smoothdata?根据我的经验,它工作得很好。

data = [-3.964575079872204, 0.35984061141417234
-3.897581013235965, 0.362519535901199
-3.8305869465997255, 0.3655679672140226
-3.763592879963486, 0.36750787804945606
-3.696598813327247, 0.3690782820590923
-3.629604746691008, 0.3682468917010495
-3.5626106800547688, 0.3662146041591672
-3.49561661341853, 0.3638128097914879
-3.4286225467822904, 0.3629814194334451
-3.3616284801460514, 0.3640899399108355
-3.294634413509812, 0.3671383712236591
-3.227640346873573, 0.37074106277517815
-3.1606462802373336, 0.3739742475009
-3.0936522136010947, 0.37628366516212997
-3.0266581469648557, 0.3796092265943012
-2.9596640803286163, 0.3848746988619056
-2.8926700136923773, 0.39152582172624806
-2.825675947056138, 0.397807437764794
-2.758681880419899, 0.40205676626145714
-2.6916878137836595, 0.4049204441613823
-2.6246937471474205, 0.4076917453548585
-2.557699680511181, 0.4103706698418854
-2.490705613874942, 0.41397336139340424
-2.4237115472387027, 0.4188693268352117
-2.3567174806024638, 0.42302627862542574
-2.289723413966225, 0.4256128264060035
-2.2227293473299854, 0.4269984770027415
-2.1557352806937464, 0.42903076454462385
-2.088741214057507, 0.43328009304128723
-2.021747147421268, 0.43854556530889144
-1.9547530807850286, 0.4430720239249024
-1.8877590141487897, 0.44584332511837843
-1.8207649475125502, 0.44815274277960837
-1.7537708808763113, 0.4505545371472879
-1.6867768142400719, 0.4545267355246032
-1.619782747603833, 0.4620092487469887
-1.552788680967594, 0.47180117963060386
-1.485794614331355, 0.48233212416581295
-1.418800547695115, 0.4924935618752251
-1.3518064810588761, 0.5014541024007975
-1.2848124144226372, 0.5077357184393432
-1.2178183477863982, 0.5130011907069478
-1.1508242811501583, 0.5187285465067981
-1.0838302145139194, 0.5254720460775899
-1.0168361478776804, 0.5309222717580928
-0.9498420812414414, 0.5355411070805527
-0.8828480146052025, 0.5401599424030128
-0.8158539479689626, 0.5454254146706172
-0.7488598813327236, 0.5523536676543073
-0.6818658146964847, 0.5602980644089388
-0.6148717480602457, 0.5667644338603828
-0.5478776814240058, 0.5721222828344363
-0.48088361478776687, 0.5781267687536344
-0.4138895481515279, 0.5863482956276134
-0.34689548151528893, 0.595308836153186
-0.27990141487904907, 0.6043617533852075
-0.2129073482428101, 0.6128604103785342
-0.14591328160657113, 0.620158170188021
-0.07891921497033216, 0.6277330601168554
-0.011925148334093194, 0.6379868745327169
0.05506891830214666, 0.6511043668485033
0.12206298493838563, 0.6641294824578408
0.1890570515746246, 0.6744756735801511
0.25605111821086357, 0.6817734333896381
0.32304518484710343, 0.6849142414089111
0.3900392514833424, 0.6835285908121731
0.45703331811958137, 0.6763232077091352
0.5240273847558203, 0.666069393293274
0.5910214513920593, 0.6572012294741507
0.6580155180282992, 0.653690914629081
0.7250095846645381, 0.6540604214548777
0.7920036513007771, 0.6539680447484284
0.8589977179370161, 0.6502729764904607
0.9259917845732559, 0.6428828399745246
0.9929858512094949, 0.6335527926231552
1.0599799178457339, 0.624315121978235
1.1269739844819728, 0.6159088416913578
1.1939680511182127, 0.6088882120012185
1.2609621177544517, 0.6032532329078173
1.3279561843906906, 0.5995581646498491
1.3949502510269296, 0.5967868634563731
1.4619443176631686, 0.5943850690886938
1.5289383842994084, 0.5905976241242767
1.5959324509356474, 0.583854124553485
1.6629265175718864, 0.5747088306150139
1.7299205842081253, 0.5630693656024148
1.7969146508443652, 0.5534621881316979
1.8639087174806042, 0.5472729487996013
1.9309027841168431, 0.5432083737158364
1.997896850753082, 0.5376657713288844
2.064890917389321, 0.5297213745742531
2.131884984025561, 0.5220541079389693
2.1988790506618, 0.5170657657907127
2.265873117298039, 0.513555450945643
2.332867183934278, 0.5102298895134718
2.399861250570517, 0.506257691136156
2.4668553172067558, 0.5020083626394927
2.5338493838429965, 0.49757428072993126
2.6008434504792355, 0.4933249522332679
2.6678375171154745, 0.4898146373881982
2.7348315837517134, 0.486489075956027
2.8018256503879524, 0.4829787611109573
2.8688197170241914, 0.4786370559078448
2.9358137836604303, 0.47198593304350234
3.0028078502966693, 0.4620092487469887
3.0698019169329083, 0.4498155234956942
3.136795983569149, 0.4367904078863569
3.203790050205388, 0.4228415252125275
3.270784116841627, 0.4085231357129011
3.337778183477866, 0.3948513831584193
3.404772250114105, 0.38219577437487895
3.471766316750344, 0.37018680253648273
3.538760383386583, 0.3600253648270706
3.605754450022822, 0.35383612549497423
3.6727485166590608, 0.35088007088859974
3.7397425832953015, 0.3489401600531665
3.8067366499315405, 0.34626123556613964
3.8737307165677795, 0.3431204275468669
3.9407247832040184, 0.3409033865920861
3.9894477407576474, 0.34001657021017384];

%%
figure;
x = data(:,1); y = data(:,2);
plot(x, y, 'linewidth', 2.5)
xlim([-4, 4])
ylim([-0.5, 1.5])
hold on;
plot(x, smoothdata(y), 'linewidth', 2.5)

字符串


的数据

相关问题