-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotfig.m
556 lines (492 loc) · 26.2 KB
/
plotfig.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
function plotfig(n,N,L,alfa,timestep,agentwidth,agenttime,Thermo)
figtime=10;
cd 'C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring'
dos(['mkdir n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo)])
%%%%%%%%%fid1
numstar=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid1numberofstar''.txt']); %the evolution of number of stars with timestep of star
y1=reshape(numstar,agenttime,[]);
figure
hold on
plot(0,N,'k:o','MarkerSize',2);
plot(1:size(y1,2), y1(agenttime,:) ,'k:o','MarkerSize',2);
xlabel(['time of star *' num2str(agenttime) ] )
ylabel('number of star')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\1fid1numberofstar_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%fid2
positstar=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid2positionofstar.txt']); %the evolution of number of stars with timestep of star
xx=reshape(positstar,N,[]);
for i=1:100*agenttime:size(xx,2)
figure;
for j=1:N
xu=unique(xx(:,i));
p=hist(xx(:,i),xu);
plot(xu,p,'ko-','MarkerSize',2);
end
xlabel('star position')
ylabel('frequence')
title(['t=',num2str(i-1)])
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid2positionofstar_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) 't=' num2str(i) '.jpg'];
saveas(gcf,str);
hold on
end
close all
%
%
%
% %%%%%%%%%%fid3
distanceofmergstar=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid3distanceofstarmerg' '.txt']); %the distrance of stars can merging
dis=distanceofmergstar(:,2);
disrange=unique(dis);
disranges=sort(disrange);
for i=1:length(disranges)
y3(i)=length(find(dis==disranges(i)));
x3(i)=disranges(i);
end
figure;
hold on
plot(x3/L,y3/length(dis),'k:o','MarkerSize',2)
xlabel('rescaled star merge distance(selected - rand)')
ylabel('probability ')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid3distanceofstarmerg_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%%fid4
intervalofmergstar=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid4intervalofstarmerg' '.txt']); %the interval time of star can merging
intervalrange=unique(intervalofmergstar);
y4=[];
for i=1:length(intervalrange)
y4(i)=length(find(intervalofmergstar==intervalrange(i)));
x4(i)=intervalrange(i);
end
figure
hold on
plot(x4/agenttime,y4/length(intervalofmergstar),'k:o','MarkerSize',2)
xlabel('star merging time interval')
ylabel('probability ')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid4intervalofstarmerg_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%%fid5
distanceofsplitstar=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid5distanceofstarsplit' '.txt']); %the distrance of stars can merging
dis5=distanceofsplitstar(:,2);
disrange5=unique(dis5);
disranges5=sort(disrange5);
for i=1:length(disranges5)
y5(i)=length(find(dis5==disranges5(i)));
x5(i)=disranges5(i);
end
figure
hold on
plot(x5/L,y5/length(dis),'k:o','MarkerSize',2)
xlabel('rescaled star spliting distance(newborn-mother)')
ylabel('probability')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid5distanceofstarsplit_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%%fid6
intervalofsplitstar=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid6intervalofstarsplit' '.txt']); %the interval time of star can merging
intervalrange=unique(intervalofsplitstar);
for i=1:length(intervalrange)
y6(i)=length(find(intervalofsplitstar==intervalrange(i)));
x6(i)=intervalrange(i);
end
figure
hold on
plot(x6/agenttime,y6/length(intervalofsplitstar),'k:o','MarkerSize',2)
xlabel('star spliting time interval')
ylabel('probability')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid6intervalofstarsplit_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid7
averopin=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid7aveopinion' '.txt']); %the evolution of average opinion with timestep of star
figure
hold on
plot(0,averopin(1)/L,'k:o','MarkerSize',2);
averopin(1)=[];
y7=reshape(averopin,agenttime,[]);
plot(1:size(y7,2), y7(agenttime,:)/L ,'k:o','MarkerSize',2);
xlabel(['time of star *' num2str(agenttime) ] )
ylabel('position average Opinion')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\2fid7aveopinion_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid13 staraverage
averopin=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid13staraveopinion' '.txt']); %the evolution of average opinion with timestep of star
figure
hold on
plot(0,averopin(1)/L,'k:o','MarkerSize',2);
averopin(1)=[];
y7=reshape(averopin,agenttime,[]);
plot(1:size(y7,2), y7(agenttime,:)/L ,'k:o','MarkerSize',2);
xlabel(['time of star *' num2str(agenttime) ] )
ylabel('star average Opinion')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\2fid13staraveopinion_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid12 agentaverage
averopin=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid12agentaveopinion' '.txt']); %the evolution of average opinion with timestep of star
figure
hold on
plot(0,averopin(1)/L,'k:o','MarkerSize',2);
averopin(1)=[];
y7=reshape(averopin,agenttime,[]);
plot(1:size(y7,2), y7(agenttime,:)/L ,'k:o','MarkerSize',2);
xlabel('time')
ylabel('agent average Opinion')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\2fid12agentaveopinion_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%%fid8
averagedegree=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid8avedegree' '.txt']); % the evolution of averagedegree with timestep of agent
y8=averagedegree(:,1);
x8=(1:length(averagedegree))';
figure
hold on
plot(x8,y8,'k:o','MarkerSize',2);
xlabel('time')
ylabel('average degree')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\3fid8avedegree_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%fid9
degree=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid9degreedistribution''.txt']); %degree probability distribution
x=degree(:,1);
y=degree(:,2);
xx=reshape(x,n,[]);
yy=reshape(y,n,[]);
for i=1:50*figtime:size(xx,2)
figure;
plot(xx(:,i),yy(:,i),'k:o','MarkerSize',2);
xlabel('degree')
ylabel('probability')
title(['t= (*2)',num2str(i)])
hold on
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid9degreedistribution_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) 't=' num2str(i) '.jpg'];
saveas(gcf,str);
close all
end
%%%%%%%%%%fid10
agentinstar=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid10numberofagentinstar' '.txt']);
eachtimestar=reshape(agentinstar,N,[]);
for i=1:50*figtime:size(eachtimestar,2)/2
figure;
ind=find(eachtimestar(:,i)~=0);
plot( eachtimestar(ind,i)/N, eachtimestar(ind,i+size(eachtimestar,2)/2)/n,'k:o')
xlabel('rescaled star position');
ylabel('percent of agent in this star');
title(['t=',num2str(i-1)]);
hold on
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid10numberofagentinstar_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) 't=' num2str(i-1) '.jpg'];
saveas(gcf,str);
close all
end
% agentinstar=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
% num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
% num2str(agenttime) 'Thermo' num2str(Thermo) '\fid10numberofagentinstar_n' num2str(n) ...
% 'N' num2str(N) 'ts' num2str(timestep) '.txt']);
% eachtimestar=reshape(agentinstar,N,[]);
% for i=size(eachtimestar,2)/2+1:10*figtime:size(eachtimestar,2)
% figure;
% ind=find(eachtimestar(:,i)~=0 );
% nonzeroeachtimestar=eachtimestar(ind,i);
% for j=1:N
% xnonzeroeachtimestar=unique(nonzeroeachtimestar);
% pro=hist(nonzeroeachtimestar,xnonzeroeachtimestar);
% plot(xnonzeroeachtimestar,pro,'ko-','MarkerSize',2);
% end
% xlabel('number of agent in one star(votes)');
% ylabel('number of star(number of candidates)');
% title(['t=',num2str(i-1-size(eachtimestar,2)/2)]);
% hold on
% str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
% num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
% num2str(agenttime) 'Thermo' num2str(Thermo) '\fid10-1probability of number in star_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) 't=' num2str(i-(size(eachtimestar,2)/2)-1) '.jpg'];
% saveas(gcf,str);
% end
% close all
%%%%%%%%%%fid14
intervalofrewire=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid14rewiringtime' '.txt']); %the distrance of stars can merging
interrange=unique(intervalofrewire);
for i=1:length(interrange)
y14(i)=length(find(intervalofrewire==interrange(i)));
end
x14=(1:length(interrange));
figure;
hold on
plot(x14,y14/length(intervalofrewire),'k:o','MarkerSize',2)
xlabel('agent rewiring time inter')
ylabel('probability')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid14rewiringtime''.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid15
disrewire=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid15rewiringdis' '.txt']);
dis=unique(disrewire);
diss15=sort(dis);
for i=1:length(diss15)
yfid15(i)=length(find(disrewire==diss15(i)));
xfid15(i)=diss15(i);
end
figure
hold on
plot(xfid15/L,yfid15/length(disrewire),'k:o','MarkerSize',2 )
xlabel('rescaled agent rewiring distance(rewiring to - origion)')
ylabel('probability')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid15rewiringdis_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid16
intervalofbreak=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid16breakingtime' '.txt']); %the distrance of stars can merging
interb=intervalofbreak;
interrangeb=unique(interb);
for i=1:length(interrangeb)
y16(i)=length(find(interb==interrangeb(i)));
end
x16=(1:length(interrangeb));
figure;
hold on
plot(x16,y16/length(interb),'k:o','MarkerSize',2)
xlabel('agent breaking link time inter')
ylabel('probability ')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid16breakingtime''.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid17
disbreak=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid17breakingdis' '.txt']);
disb=unique(disbreak);
disbs17=sort(disb);
for i=1:length(disbs17)
yfid17(i)=length(find(disbreak==disbs17(i)));
xfid17(i)=disbs17(i);
end
figure
hold on
plot(xfid17/L,yfid17/length(disbreak),'k:o','MarkerSize',2 )
xlabel('agent breaking link''s star rescaled distance')
ylabel('probability')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid17breakingdis_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid18
interadd=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid18addingtime' '.txt']);
intera=unique(interadd);
for i=1:length(intera)
yfid18(i)=length(find(interadd==intera(i)));
end
xfid18=(1:length(intera));
figure
hold on
plot(xfid18,yfid18/sum(yfid18),'k:o','MarkerSize',2 )
xlabel('agent adding link time interval')
ylabel('probability')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid18addingtime_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid19
disadd=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid19addingdis' '.txt']);
disa=unique(disadd);
c19=0;
for i=1:length(disa)
yfid19(i)=length(find(disadd==disa(i)));
c19=c19+yfid19(i);
end
xfid19=(1:length(disa));
figure
hold on
plot(xfid19/L,yfid19/c19,'k:o','MarkerSize',2 )
xlabel('rescaled agent adding link''s star distance')
ylabel('probability of adding')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\fid19addingdis_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid20
% avgdegstar=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
% num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
% num2str(agenttime) 'Thermo' num2str(Thermo) '\avgdegreetostar' '.txt']);
% eachtimeavgstar=reshape(avgdegstar,N,[]);
% for i=1:50*figtime:size(eachtimeavgstar,2)/2
% figure;
% ind=find(eachtimeavgstar(:,i)~=0);
% plot( eachtimeavgstar(ind,i)/L,eachtimeavgstar(ind,i+size(eachtimeavgstar,2)/2),'k:o','MarkerSize',2 )
% xlabel('rescaled star position');
% ylabel('average degree in this star');
% title(['t=',num2str(i-1)]);
% hold on
% str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
% num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
% num2str(agenttime) 'Thermo' num2str(Thermo) '\avgdegreetostar_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) 't=' num2str(i-1) '.jpg'];
% saveas(gcf,str);
% close all
% end
%%%%%%%%%%fid21
% connet=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
% num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
% num2str(agenttime) 'Thermo' num2str(Thermo) '\edgeconnectstrength' '.txt']);
% strengcon=reshape(connet,N,[]);
% for i=1:50*figtime:size(strengcon,2)/2
% figure;
% ind=find(strengcon(:,i)~=0);
% plot( strengcon(ind,i)/L,strengcon(ind,i+size(strengcon,2)/2),'k:o','MarkerSize',2)
% xlabel('rescaled star position');
% ylabel('edge connection strength in this position(linkinstar/linkoutstar)');
% title(['t=',num2str(i-1)]);
% hold on
% str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
% num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
% num2str(agenttime) 'Thermo' num2str(Thermo) '\edgeconnectstrength_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) 't=' num2str(i-1) '.jpg'];
% saveas(gcf,str);
% close all
% end
%%%%%%%%%%fid22
eloevo=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\eloposition' '.txt']);
elo=reshape(eloevo,N,[]);
for i=1:50*figtime:size(elo,2)/2
figure;
ind=find(elo(:,i)~=0);
plot( elo(ind,i)/L,elo(ind,i+size(elo,2)/2),'k:o','MarkerSize',2)
xlabel('rescaled star position');
ylabel('elo in this position');
title(['t=',num2str(i-1)]);
hold on
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\eloposition_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) 't=' num2str(i-1) '.jpg'];
saveas(gcf,str);
close all
end
%%%%%%%%%%fid23
agedis=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\agedistribution' '.txt']); %the
age=unique(agedis);
for i=1:length(age)
y23(i)=length(find(agedis==age(i)));
end
x23=(1:length(age));
figure
hold on
loglog(x23,y23/length(agedis),'k:o','MarkerSize',2)
xlabel('age')
ylabel('probability of existed age')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\agedistribution_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid24
link=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\link2split' '.txt']);
linkdis=unique(link);
for i=1:length(linkdis)
y24(i)=length(find(link==linkdis(1)));
end
x24=(1:length(linkdis));
figure
hold on
plot(x24/n,y24/length(link),'k:o','MarkerSize',2)
xlabel('split link percent(number/n)')
ylabel('probability of split link number ')
str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
num2str(agenttime) 'Thermo' num2str(Thermo) '\link2split_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) '.jpg'];
saveas(gcf,str);
close all
%%%%%%%%%%fid25
% nodeconnet=load(['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
% num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
% num2str(agenttime) 'Thermo' num2str(Thermo) '\nodeconnectstrength' '.txt']);
% nodestrengcon=reshape(nodeconnet,N,[]);
% for i=1:50*figtime:size(nodestrengcon,2)/2
% figure;
% ind=find(nodestrengcon(:,i)~=0);
% plot( nodestrengcon(ind,i)/L,nodestrengcon(ind,i+size(nodestrengcon,2)/2),'k:o','MarkerSize',2)
% xlabel('rescaled star position');
% ylabel('node connection strength in this position(nodeinstar/nodeinstarconnectednode)');
% title(['t=',num2str(i-1)]);
% hold on
% str=['C:\Temp\Wang\matlab data\opinionmodel\2010.11.26with neighbor rewiring\n' num2str(n) 'N' ...
% num2str(N) 'ts' num2str(timestep) 'alfa' num2str(alfa) 'agentwidth' num2str(agentwidth) 'agenttime' ...
% num2str(agenttime) 'Thermo' num2str(Thermo) '\nodeconnectstrength_n' num2str(n) 'N' num2str(N) 'ts' num2str(timestep) 't=' num2str(i-1) '.jpg'];
% saveas(gcf,str);
% close all
% end
end