matlab中的水平标准偏差填充图

horizontal standard deviation fill plot in matlab

我有一个示例文件。第一列是我的 y 轴(代表深度)。第二列是平均值。第三列是平均值+标准差,第四列是平均值-标准差。

50      8,52021458848310    12,8530947497846    4,18733442718158
100     19,2273240305912    23,7734814467110    14,6811666144714
150     24,2615944638934    30,2678190187990    18,2553699089878
200     30,6833427597963    39,4337701225571    21,9329153970354
250     34,9509485935449    47,8249116812250    22,0769855058648
300     32,4629780635280    40,1731214462594    24,7528346807966
350     33,7584752483269    43,2424890071851    24,2744614894686
400     39,6944893679358    52,5666743873288    26,8223043485428
450     46,5051455836423    63,5570927760677    29,4531983912169
500     49,0458418910265    70,7507807967089    27,3409029853441
550     52,0737915678693    70,5030313767484    33,6445517589901
600     57,5870126919132    81,1282679272898    34,0457574565365
650     58,7946350532416    85,0428844330643    32,5463856734189
700     59,3263566691245    92,6606340696131    25,9920792686359
750     69,0930407230073    105,935771600040    32,2503098459742
800     71,4416953118855    113,211405934863    29,6719846889079
850     70,3617175991868    111,663890244861    29,0595449535130
900     64,7764846391086    97,4995723191651    32,0533969590521
950     70,7142864622626    102,429751242886    38,9988216816390
1000    88,0269426788223    123,259291760572    52,7945935970724
1250    126,529915074894    193,319779063845    59,7400510859419
1500    173,395473019573    242,127131744655    104,663814294491
1750    225,087445395238    300,319434885651    149,855455904824
2000    269,218588809667    295,582291796995    242,854885822339
figure();
plot(example(:,2),example(:,1),'b-x','linewidth',2);
set(gca,'ydir','rev','xlim',[0 400],'ylim',[0 2000]);
grid on; hold on;
fill( [example(:,3) fliplr(example(:,4))], [example(:,1) fliplr(example(:,1))], 'k'); alpha(.25);

我在地块上的填充区域没有按应有的方式显示。而且我也不太确定问题出在哪里。我得到的是左边的图像,但它真正应该是右边的图像,除了填充。

更正向量对齐,即将所有向量对齐到一个大向量。否则你有两组向量,它们被分开

[example(:,x) example(:,y)] --> [example(:,x); example(:,y)]

用 flipud 代替 fliplr

fliplr(example(:,x)) // --> does nothing
flipud(example(:,x)) // --> for a column vector the correct approach

一个工作代码示例

%%
example = [50      8.52021458848310    12.8530947497846    4.18733442718158
100     19.2273240305912    23.7734814467110    14.6811666144714
150     24.2615944638934    30.2678190187990    18.2553699089878
200     30.6833427597963    39.4337701225571    21.9329153970354
250     34.9509485935449    47.8249116812250    22.0769855058648
300     32.4629780635280    40.1731214462594    24.7528346807966
350     33.7584752483269    43.2424890071851    24.2744614894686
400     39.6944893679358    52.5666743873288    26.8223043485428
450     46.5051455836423    63.5570927760677    29.4531983912169
500     49.0458418910265    70.7507807967089    27.3409029853441
550     52.0737915678693    70.5030313767484    33.6445517589901
600     57.5870126919132    81.1282679272898    34.0457574565365
650     58.7946350532416    85.0428844330643    32.5463856734189
700     59.3263566691245    92.6606340696131    25.9920792686359
750     69.0930407230073    105.935771600040    32.2503098459742
800     71.4416953118855    113.211405934863    29.6719846889079
850     70.3617175991868    111.663890244861    29.0595449535130
900     64.7764846391086    97.4995723191651    32.0533969590521
950     70.7142864622626    102.429751242886    38.9988216816390
1000    88.0269426788223    123.259291760572    52.7945935970724
1250    126.529915074894    193.319779063845    59.7400510859419
1500    173.395473019573    242.127131744655    104.663814294491
1750    225.087445395238    300.319434885651    149.855455904824
2000    269.218588809667    295.582291796995    242.854885822339];
figure();
plot(example(:,2),example(:,1),'b-x','linewidth',2);
set(gca,'ydir','rev','xlim',[0 400],'ylim',[0 2000]);
grid on; hold on;
plot(example(:,4), example(:,1))
plot(example(:,3), example(:,1))
fill( [example(:,3); flipud(example(:,4))], [example(:,1); flipud(example(:,1))], 'k'); alpha(.25);