How to fix such type of problem?
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Star Strider
on 22 Jun 2023
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')
Cov_4GAPSO = LD2.Cov_4GAPSO;
LD3 = load('Cov_4PSO')
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 Comment
Steven Lord
on 22 Jun 2023
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)
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)
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!