How to connect dots on graph?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a code that holds some energy values for some n states(n=1,2,3,4,5... etc) I want to connect these values for same n numbers. However, I have values by second variable which is E-field (=0.1 , 0.2 , 0.3... etc). I need to plot Energy values vs E-field. So i can only plot the values as dots. how can i connect them as i show in picture?

Here's my code that only plot dots:
E1=[0.229711113281264;0.244475859375016;0.261230097656256;0.283730156249987;0.311849589843713;0.344379609374935;0.379151660156155;0.412348945312377;0.440260371093603];
E2=[0.238093886718765;0.260254335937507;0.279635683593740;0.301875937499971;0.329453378906198;0.361535156249920;0.395869863281141;0.429274687499862;0.463113339843583];
E3=[0.244694238281266;0.273560273437496;0.297322089843725;0.320574257812455;0.347550292968682;0.378919335937405;0.412740058593626;0.447448828124847;0.488205761718562];
E4=[0.250286660156265;0.285135234374986;0.313481660156211;0.339145078124939;0.366044472656166;0.396619687499890;0.430194082031111;0.467239687499830;0.514716503906040];
E5=[0.255198222656261;0.295503046874977;0.328158457031199;0.356915859374924;0.384692636718650;0.414790078124875;0.448644785156096;0.488550234374812;0.542196972656016];
E6=[0.259605410156258;0.304969453124969;0.341621425781187;0.373596210937410;0.403165253906135;0.433584023437359;0.468303222656079;0.511142695312293;0.570388300780993];
E7=[0.263617441406254;0.313727578124961;0.354115136718677;0.389235234374897;0.421238613281119;0.453036093749842;0.489155683593561;0.534785976562273;0.599128183593469;0.830071523437023];
E8=[0.267308027343751;0.321910312499954;0.365831894531167;0.404029453124884;0.438887988281104;0.473031210937325;0.511045605468543;0.559290117187253;0.628306582030944;0.836473710937018];
E9=[0.270730136718748;0.329615156249948;0.376924863281157;0.418195195312372;0.456210761718590;0.493391718749808;0.533761933593524;0.584503828124731;0.657845332030919;0.842466445312013];
E10=[0.273923496093745;0.336917695312442;0.387519667968648;0.431917382812361;0.473320605468575;0.513964687499791;0.557098300781005;0.610304999999710;0.687685605468395;0.848114062499509;0.956153847655667];
x1=.1;
x2=.2;
x3=.3;
x4=.4;
x5=.5;
x6=.6;
x7=.7;
x8=.8;
x9=.9;
x10=1;
hold on
grid on
axis([0 1 0.2 1])
xlabel('E field (V/m)')
ylabel('Energy Values (eV)')
plot(x1,E1,'o')
plot(x2,E2,'o')
plot(x3,E3,'o')
plot(x4,E4,'o')
plot(x5,E5,'o')
plot(x6,E6,'o')
plot(x7,E7,'o')
plot(x8,E8,'o')
plot(x9,E9,'o')
plot(x10,E10,'o')
0 Commenti
Risposta accettata
KSSV
il 22 Mag 2019
Modificato: KSSV
il 22 Mag 2019
E1=[0.229711113281264;0.244475859375016;0.261230097656256;0.283730156249987;0.311849589843713;0.344379609374935;0.379151660156155;0.412348945312377;0.440260371093603];
E2=[0.238093886718765;0.260254335937507;0.279635683593740;0.301875937499971;0.329453378906198;0.361535156249920;0.395869863281141;0.429274687499862;0.463113339843583];
E3=[0.244694238281266;0.273560273437496;0.297322089843725;0.320574257812455;0.347550292968682;0.378919335937405;0.412740058593626;0.447448828124847;0.488205761718562];
E4=[0.250286660156265;0.285135234374986;0.313481660156211;0.339145078124939;0.366044472656166;0.396619687499890;0.430194082031111;0.467239687499830;0.514716503906040];
E5=[0.255198222656261;0.295503046874977;0.328158457031199;0.356915859374924;0.384692636718650;0.414790078124875;0.448644785156096;0.488550234374812;0.542196972656016];
E6=[0.259605410156258;0.304969453124969;0.341621425781187;0.373596210937410;0.403165253906135;0.433584023437359;0.468303222656079;0.511142695312293;0.570388300780993];
E7=[0.263617441406254;0.313727578124961;0.354115136718677;0.389235234374897;0.421238613281119;0.453036093749842;0.489155683593561;0.534785976562273;0.599128183593469;0.830071523437023];
E8=[0.267308027343751;0.321910312499954;0.365831894531167;0.404029453124884;0.438887988281104;0.473031210937325;0.511045605468543;0.559290117187253;0.628306582030944;0.836473710937018];
E9=[0.270730136718748;0.329615156249948;0.376924863281157;0.418195195312372;0.456210761718590;0.493391718749808;0.533761933593524;0.584503828124731;0.657845332030919;0.842466445312013];
E10=[0.273923496093745;0.336917695312442;0.387519667968648;0.431917382812361;0.473320605468575;0.513964687499791;0.557098300781005;0.610304999999710;0.687685605468395;0.848114062499509;0.956153847655667];
x1=.1;
x2=.2;
x3=.3;
x4=.4;
x5=.5;
x6=.6;
x7=.7;
x8=.8;
x9=.9;
x10=1;
hold on
grid on
axis([0 1 0.2 1])
xlabel('E field (V/m)')
ylabel('Energy Values (eV)')
plot(x1*ones(size(E1)),E1,'-o')
plot(x2*ones(size(E2)),E2,'-o')
plot(x3*ones(size(E3)),E3,'-o')
plot(x4*ones(size(E4)),E4,'-o')
plot(x5*ones(size(E5)),E5,'-o')
plot(x6*ones(size(E6)),E6,'-o')
plot(x7*ones(size(E7)),E7,'-o')
plot(x8*ones(size(E8)),E8,'-o')
plot(x9*ones(size(E9)),E9,'-o')
plot(x10*ones(size(E10)),E10,'-o')
5 Commenti
KSSV
il 22 Mag 2019
In that case the first code works......your E's all should be of same size....they were not.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!