How to fix such type of problem?

1 回表示 (過去 30 日間)
Assen Beshr
Assen Beshr 2023 年 6 月 22 日
コメント済み: Steven Lord 2023 年 6 月 22 日
I want to plot 3 convergency graph in one axis but the graph can't show one (GA) case. please how to solve it. the data are give below
% the variables are present at attached file
A= 0.0285612600073257 0.0285612600073257 0.0285612600073257 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260486151704578 0.0253622114928302 0.0253622114928302 0.0253622114928302 0.0251894283762862 0.0251894283762862 0.0251894283762862 0.0251894283762862 0.0250896759259265 0.0250000291029496 0.0247902083604033 0.0247894534109922 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0241787495787096 0.0239744022067768 0.0238908784687558 0.0238908784687558 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237816436140365 0.0237305218018257 0.0237305218018257 0.0236774825941490 0.0236774825941490 0.0236586201758395 0.0236586201758395 0.0236364005677557 0.0236364005677557 0.0236364005677557 0.0236215692784047 0.0236093802490931 0.0236093802490931 0.0236068175810124 0.0236050246368940 0.0236021296180890 0.0236006195701535 0.0236003916878031 0.0235986041499287 0.0235965801993443 0.0235952849410373 0.0235942403441116 0.0235928119583880 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235876074929349 0.0235872670652811 0.0235863705198906 0.0235860569893192 0.0235860569893192 0.0235857474315192 0.0235839247001298 0.0235839247001298 0.0235839247001298 0.0235835152359898 0.0235835152359898 0.0235824653407232 0.0235824653407232 0.0235813613987210 0.0235813613987210 0.0235813613987210 0.0235813613987210 0.0235811814043260 0.0235807577366231 0.0235800739908033 0.0235799784057793 0.0235798456955290 0.0235793571759432 0.0235777385424167 0.0235777385424167 0.0235777385424167 0.0235777385424167 0.0235777346018952 0.0235777346018952 0.0235766876839610 0.0235766313230234 0.0235764733699453 0.0235759542144127
B=0.0275711474007937 0.0275711474007937 0.0267446505836316 0.0261541181542515 0.0260305227655914 0.0238680505433116 0.0238381814529130 0.0238381814529130 0.0237408178556666 0.0236743518805784 0.0233571417233799 0.0232963680335816 0.0232963680335816 0.0229164943003430 0.0229164943003430 0.0221118509295384 0.0221118509295384 0.0221118509295384 0.0221118509295384 0.0221118509295384 0.0217107600918145 0.0217107600918145 0.0217107600918145 0.0217107600918145 0.0217107600918145 0.0217018247624917 0.0214216615585489 0.0214216615585489 0.0214216615585489 0.0214080927009179 0.0214080927009179 0.0214080927009179 0.0213981529090190 0.0213981529090190 0.0213707001405316 0.0213707001405316 0.0213638007872935 0.0213392603070582 0.0213392603070582 0.0213327462582150 0.0213287622766964 0.0213090711930261 0.0213081033114963 0.0213081033114963 0.0212982994776620 0.0212950902439987 0.0212950902439987 0.0212940984028959 0.0212935425537059 0.0210945260366561 0.0210945260366561 0.0210945260366561 0.0210945260366561 0.0210945260366561 0.0208602878927831 0.0208440395466891 0.0208440395466891 0.0208440395466891 0.0208439312731205 0.0208396561977250 0.0208293226421201 0.0208269753107356 0.0208269753107356 0.0208269753107356 0.0208269753107356 0.0208269753107356 0.0208269753107356 0.0208269434923779 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208238614885052 0.0208238614885052 0.0208238614885052
C=0.0285612600073257 0.0285612600073257 0.0285612600073257 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260486151704578 0.0253622114928302 0.0253622114928302 0.0253622114928302 0.0251894283762862 0.0251894283762862 0.0251894283762862 0.0251894283762862 0.0250896759259265 0.0250000291029496 0.0247902083604033 0.0247894534109922 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0241787495787096 0.0239744022067768 0.0238908784687558 0.0238908784687558 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237816436140365 0.0237305218018257 0.0237305218018257 0.0236774825941490 0.0236774825941490 0.0236586201758395 0.0236586201758395 0.0236364005677557 0.0236364005677557 0.0236364005677557 0.0236215692784047 0.0236093802490931 0.0236093802490931 0.0236068175810124 0.0236050246368940 0.0236021296180890 0.0236006195701535 0.0236003916878031 0.0235986041499287 0.0235965801993443 0.0235952849410373 0.0235942403441116 0.0235928119583880 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235876074929349 0.0235872670652811 0.0235863705198906 0.0235860569893192 0.0235860569893192 0.0235857474315192 0.0235839247001298 0.0235839247001298 0.0235839247001298 0.0235835152359898 0.0235835152359898 0.0235824653407232 0.0235824653407232 0.0235813613987210 0.0235813613987210 0.0235813613987210 0.0235813613987210 0.0235811814043260 0.0235807577366231 0.0235800739908033 0.0235799784057793 0.0235798456955290 0.0235793571759432 0.0235777385424167 0.0235777385424167 0.0235777385424167 0.0235777385424167 0.0235777346018952 0.0235777346018952 0.0235766876839610 0.0235766313230234 0.0235764733699453 0.0235759542144127
Cov_4GA=A'
Cov_4GAPSO=B'
Cov_4PSO=C'
% plot graph
plot(Cov_4GA,'r')
hold on
plot(Cov_4PSO,'b')
plot(Cov_4GAPSO,'k')
legend('GA','PSO','GAPSO')
xlabel('Iterration')
ylabel('MOF')
l get this grah

採用された回答

Star Strider
Star Strider 2023 年 6 月 22 日
The firstr two appear to be exactly the same, so they are over-plotting.
% the variables are present at attached file
LD1 = load('Cov_4GA');
Cov_4GA = LD1.Cov_4GA;
LD2 = load('Cov_4GAPSO')
LD2 = struct with fields:
Cov_4GAPSO: [100×1 double]
Cov_4GAPSO = LD2.Cov_4GAPSO;
LD3 = load('Cov_4PSO')
LD3 = struct with fields:
Cov_4PSO: [100×1 double]
Cov_4PSO = LD3.Cov_4PSO;
% plot graph
plot(Cov_4GA,'r')
hold on
plot(Cov_4PSO,'b')
plot(Cov_4GAPSO,'k')
legend('GA','PSO','GAPSO')
xlabel('Iterration')
ylabel('MOF')
figure
tiledlayout(3,1)
nexttile
plot(Cov_4GA,'r')
title('GA')
xlabel('Iterration')
ylabel('MOF')
nexttile
plot(Cov_4PSO,'b')
title('PSO')
xlabel('Iterration')
ylabel('MOF')
nexttile
plot(Cov_4GAPSO,'k')
title('GAPSO')
xlabel('Iterration')
ylabel('MOF')
.
  1 件のコメント
Steven Lord
Steven Lord 2023 年 6 月 22 日
A= [0.0285612600073257 0.0285612600073257 0.0285612600073257 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260486151704578 0.0253622114928302 0.0253622114928302 0.0253622114928302 0.0251894283762862 0.0251894283762862 0.0251894283762862 0.0251894283762862 0.0250896759259265 0.0250000291029496 0.0247902083604033 0.0247894534109922 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0241787495787096 0.0239744022067768 0.0238908784687558 0.0238908784687558 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237816436140365 0.0237305218018257 0.0237305218018257 0.0236774825941490 0.0236774825941490 0.0236586201758395 0.0236586201758395 0.0236364005677557 0.0236364005677557 0.0236364005677557 0.0236215692784047 0.0236093802490931 0.0236093802490931 0.0236068175810124 0.0236050246368940 0.0236021296180890 0.0236006195701535 0.0236003916878031 0.0235986041499287 0.0235965801993443 0.0235952849410373 0.0235942403441116 0.0235928119583880 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235876074929349 0.0235872670652811 0.0235863705198906 0.0235860569893192 0.0235860569893192 0.0235857474315192 0.0235839247001298 0.0235839247001298 0.0235839247001298 0.0235835152359898 0.0235835152359898 0.0235824653407232 0.0235824653407232 0.0235813613987210 0.0235813613987210 0.0235813613987210 0.0235813613987210 0.0235811814043260 0.0235807577366231 0.0235800739908033 0.0235799784057793 0.0235798456955290 0.0235793571759432 0.0235777385424167 0.0235777385424167 0.0235777385424167 0.0235777385424167 0.0235777346018952 0.0235777346018952 0.0235766876839610 0.0235766313230234 0.0235764733699453 0.0235759542144127];
B=[0.0275711474007937 0.0275711474007937 0.0267446505836316 0.0261541181542515 0.0260305227655914 0.0238680505433116 0.0238381814529130 0.0238381814529130 0.0237408178556666 0.0236743518805784 0.0233571417233799 0.0232963680335816 0.0232963680335816 0.0229164943003430 0.0229164943003430 0.0221118509295384 0.0221118509295384 0.0221118509295384 0.0221118509295384 0.0221118509295384 0.0217107600918145 0.0217107600918145 0.0217107600918145 0.0217107600918145 0.0217107600918145 0.0217018247624917 0.0214216615585489 0.0214216615585489 0.0214216615585489 0.0214080927009179 0.0214080927009179 0.0214080927009179 0.0213981529090190 0.0213981529090190 0.0213707001405316 0.0213707001405316 0.0213638007872935 0.0213392603070582 0.0213392603070582 0.0213327462582150 0.0213287622766964 0.0213090711930261 0.0213081033114963 0.0213081033114963 0.0212982994776620 0.0212950902439987 0.0212950902439987 0.0212940984028959 0.0212935425537059 0.0210945260366561 0.0210945260366561 0.0210945260366561 0.0210945260366561 0.0210945260366561 0.0208602878927831 0.0208440395466891 0.0208440395466891 0.0208440395466891 0.0208439312731205 0.0208396561977250 0.0208293226421201 0.0208269753107356 0.0208269753107356 0.0208269753107356 0.0208269753107356 0.0208269753107356 0.0208269753107356 0.0208269434923779 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269379380701 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208269238715889 0.0208238614885052 0.0208238614885052 0.0208238614885052];
C=[0.0285612600073257 0.0285612600073257 0.0285612600073257 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260809206714874 0.0260486151704578 0.0253622114928302 0.0253622114928302 0.0253622114928302 0.0251894283762862 0.0251894283762862 0.0251894283762862 0.0251894283762862 0.0250896759259265 0.0250000291029496 0.0247902083604033 0.0247894534109922 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0242333809691646 0.0241787495787096 0.0239744022067768 0.0238908784687558 0.0238908784687558 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237823606150859 0.0237816436140365 0.0237305218018257 0.0237305218018257 0.0236774825941490 0.0236774825941490 0.0236586201758395 0.0236586201758395 0.0236364005677557 0.0236364005677557 0.0236364005677557 0.0236215692784047 0.0236093802490931 0.0236093802490931 0.0236068175810124 0.0236050246368940 0.0236021296180890 0.0236006195701535 0.0236003916878031 0.0235986041499287 0.0235965801993443 0.0235952849410373 0.0235942403441116 0.0235928119583880 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235879358434001 0.0235876074929349 0.0235872670652811 0.0235863705198906 0.0235860569893192 0.0235860569893192 0.0235857474315192 0.0235839247001298 0.0235839247001298 0.0235839247001298 0.0235835152359898 0.0235835152359898 0.0235824653407232 0.0235824653407232 0.0235813613987210 0.0235813613987210 0.0235813613987210 0.0235813613987210 0.0235811814043260 0.0235807577366231 0.0235800739908033 0.0235799784057793 0.0235798456955290 0.0235793571759432 0.0235777385424167 0.0235777385424167 0.0235777385424167 0.0235777385424167 0.0235777346018952 0.0235777346018952 0.0235766876839610 0.0235766313230234 0.0235764733699453 0.0235759542144127];
isequal(A, C)
ans = logical
1
Not only do they appear to be the same, they are equal. Note that the data in your file might not be exactly down-to-the-last-bit identical, but I'd expect the norm of the difference between the two to be very, very small even if it's not exactly 0. That indicates they're very, very close together and so as Star Strider said their plots overlap.
norm(A-C)
ans = 0

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by