-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlotcombined4(racinggame6 & set3trace23).m
255 lines (212 loc) · 10.6 KB
/
Plotcombined4(racinggame6 & set3trace23).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
(* ::Package:: *)
(* ::Input:: *)
(*ClearAll["Global`*"]*)
(*SetDirectory["/Users/humayrajeba/Documents/Wolfram Mathematica/processed_data_dBm"];*)
(*data=Import["updated_racing_6.txt","Table"];*)
(*micromobility=data[[All,2]];*)
(*SetDirectory["/Users/humayrajeba/Documents/Wolfram Mathematica/THzBlock"];*)
(*data=Import["Set3_H=135cm_L13=450cm_L12=300cm/DATA_UNCAL_Meas22","Table"];*)
(*avgParam=20;*)
(*percentage=5;*)
(*blockage=data[[All,2]];*)
(* ::Input:: *)
(*micromobility*)
(*blockage*)
(* ::Input:: *)
(*(*Calculate the weighted signal and its exponential moving average*)*)
(*block1=10*Log10[blockage]*)
(* ::Input:: *)
(*micro1=Take[micromobility]*)
(* ::Input:: *)
(*microPeriodogram=PeriodogramArray@micro1*)
(*ListLinePlot[micro1,PlotRange->All]*)
(**)
(*blockPeriodogram=PeriodogramArray@block1*)
(*ListLinePlot[block1+35,PlotRange->All]*)
(**)
(* ::Input:: *)
(*microPeriodogram=PeriodogramArray[micro1];*)
(*blockPeriodogram=PeriodogramArray[block1];*)
(**)
(*ListLinePlot[{micro1,block1+37},PlotRange->All,PlotLegends->{"Micro1","Block1"}]*)
(**)
(* ::Input:: *)
(*ListLinePlot[{micro1[[30000;;80000]],block1[[20000;;70000]]+20},PlotRange->All,PlotStyle->{BlueGray},PlotLegends->Placed[{"Micro1","Block1"},{0.2,0.2}]]*)
(**)
(* ::Input:: *)
(*block=block1+35*)
(*decayRate1=0.001;*)
(*movingAvg1=Re[ExponentialMovingAverage[block,decayRate1]]*)
(*ListLinePlot[movingAvg1,PlotRange->All]*)
(*decayRate2=0.0001;*)
(*movingAvg2=Re[ExponentialMovingAverage[block,decayRate2]]*)
(*ListLinePlot[movingAvg2,PlotRange->All]*)
(* ::Input:: *)
(*movingAvg3=Re[ExponentialMovingAverage[micromobility,decayRate1]]*)
(*ListLinePlot[movingAvg3,PlotRange->All]*)
(*movingAvg4=Re[ExponentialMovingAverage[micromobility,decayRate2]]*)
(*ListLinePlot[movingAvg4,PlotRange->All]*)
(* ::Input:: *)
(*ListLinePlot[{movingAvg1[[20000;;70000]],movingAvg3[[20000;;70000]]+15},PlotRange->{{20000,50000},All},PlotStyle->{BlueGray},PlotLegends->Placed[{"Micro for 0.001","Block for 0.001"},{0.8,0.7}]]*)
(* ::Input:: *)
(*ListLinePlot[{movingAvg2[[20000;;70000]],movingAvg4[[20000;;70000]]+16},PlotRange->{{20000,50000},All},PlotStyle->{BlueGray},PlotLegends->Placed[{"Micro for 0.0001","Block for 0.0001"},{0.4,0.6}]]*)
(* ::Input:: *)
(*(*Initialize the list to store the sum of periodograms without decay rate*)*)
(*sumPeriodograms={};*)
(**)
(*(*Calculate the number of segments*)*)
(*numSegments=Quotient[Length[block],500];*)
(**)
(*(*Loop through each segment*)*)
(*For[i=1,i<=numSegments,i++,*)
(*(*Extract the i^th segment of 500 values*)*)
(*blockSegment=Take[block,{500*(i-1)+1,500*i}];*)
(*(*Compute the periodogram for the current segment*)*)
(*periodogram=PeriodogramArray[blockSegment];*)
(*(*Sum up the values of the periodogram*)*)
(*sumPeriodogram=Total[periodogram];*)
(*(*Append the sum to the list*)*)
(*AppendTo[sumPeriodograms,sumPeriodogram];]*)
(**)
(*(*Output the list of summed periodograms for blockage trace*)*)
(*sumPeriodograms*)
(* ::Input:: *)
(*(*Plot the summed periodograms for blockage trace*)*)
(*ListLinePlot[sumPeriodograms,PlotRange->All,*)
(*PlotLabel->"Summed Periodograms for blockage original",*)
(*AxesLabel->{"Segment Index","Sum of Periodogram Values"}]*)
(*(*Plot the summed periodograms with smaller dots and thinner lines*)ListPlot[sumPeriodograms,Joined->True,PlotStyle->{Blue,Thin},PlotRange->All,PlotMarkers->{Automatic,Small},PlotLabel->"Summed Periodograms for blockage",AxesLabel->{"Segment Index","Sum of Periodogram Values"},ImageSize->Large]*)
(* ::Input:: *)
(*(*Initialize the list to store the sum of periodograms without decay rate*)*)
(*sumPeriodograms1={};*)
(**)
(*(*Calculate the number of segments*)*)
(*numSegments1=Quotient[Length[micromobility],500];*)
(**)
(*(*Loop through each segment*)*)
(*For[i=1,i<=numSegments1,i++,*)
(*(*Extract the i^th segment of 500 values*)*)
(*microSegment1=Take[micromobility,{500*(i-1)+1,500*i}];*)
(*(*Compute the periodogram for the current segment*)*)
(*periodogram1=PeriodogramArray[microSegment1];*)
(*(*Sum up the values of the periodogram*)*)
(*sumPeriodogram1=Total[periodogram1];*)
(*(*Append the sum to the list*)*)
(*AppendTo[sumPeriodograms1,sumPeriodogram1];]*)
(**)
(*(*Output the list of summed periodograms for micromobility*)*)
(*sumPeriodograms1*)
(* ::Input:: *)
(*(*Plot the summed periodograms*)*)
(*ListLinePlot[sumPeriodograms1,PlotRange->All,*)
(*PlotLabel->"Summed Periodograms for micromobility original",*)
(*AxesLabel->{"Segment Index","Sum of Periodogram Values"}]*)
(*(*Plot the summed periodograms with smaller dots and thinner lines*)ListPlot[sumPeriodograms1,Joined->True,PlotStyle->{Blue,Thin},PlotRange->All,PlotMarkers->{Automatic,Small},PlotLabel->"Summed Periodograms for micromobility",AxesLabel->{"Segment Index","Sum of Periodogram Values"},ImageSize->Large]*)
(* ::Input:: *)
(*ListLinePlot[{sumPeriodograms1+46152,sumPeriodograms},PlotRange->{{0,163},All},PlotStyle->{BlueGray},PlotLabel->"Summed Periodograms original micromobility & blockage",PlotLegends->Placed[{"Micro original","Block original"},{0.2,0.8}]]*)
(* ::Input:: *)
(*(*Initialize the list to store the sum of periodograms with 0.001 decay rate for blockage*)*)
(*sumPeriodograms2={};*)
(**)
(*(*Calculate the number of segments*)*)
(*numSegments2=Quotient[Length[movingAvg1],500];*)
(**)
(*(*Loop through each segment*)*)
(*For[i=1,i<=numSegments2,i++,*)
(*(*Extract the i^th segment of 500 values*)*)
(*blockSegment2=Take[movingAvg1,{500*(i-1)+1,500*i}];*)
(*(*Compute the periodogram for the current segment*)*)
(*periodogram2=PeriodogramArray[blockSegment2];*)
(*(*Sum up the values of the periodogram*)*)
(*sumPeriodogram2=Total[periodogram2];*)
(*(*Append the sum to the list*)*)
(*AppendTo[sumPeriodograms2,sumPeriodogram2];]*)
(**)
(*(*Output the list of summed periodograms for blockage trace*)*)
(*sumPeriodograms2*)
(*(*Plot the summed periodograms for 0.001*)*)
(*ListLinePlot[sumPeriodograms2,PlotRange->All,*)
(*PlotLabel->"Summed Periodograms for 0.001 of blockage",*)
(*AxesLabel->{"Segment Index","Sum of Periodogram Values"}]*)
(*(*Plot the summed periodograms with smaller dots and thinner lines*)ListPlot[sumPeriodograms2,Joined->True,PlotStyle->{Blue,Thin},PlotRange->All,PlotMarkers->{Automatic,Small},PlotLabel->"Summed Periodograms for 0.001 of blockage",AxesLabel->{"Segment Index","Sum of Periodogram "},ImageSize->Large]*)
(**)
(* ::Input:: *)
(*(*Initialize the list to store the sum of periodograms with 0.001 decay rate for micromobility*)*)
(*sumPeriodograms3={};*)
(**)
(*(*Calculate the number of segments*)*)
(*numSegments3=Quotient[Length[movingAvg3],500];*)
(**)
(*(*Loop through each segment*)*)
(*For[i=1,i<=numSegments2,i++,*)
(*(*Extract the i^th segment of 500 values*)*)
(*blockSegment3=Take[movingAvg3,{500*(i-1)+1,500*i}];*)
(*(*Compute the periodogram for the current segment*)*)
(*periodogram3=PeriodogramArray[blockSegment3];*)
(*(*Sum up the values of the periodogram*)*)
(*sumPeriodogram3=Total[periodogram3];*)
(*(*Append the sum to the list*)*)
(*AppendTo[sumPeriodograms3,sumPeriodogram3];]*)
(**)
(*(*Output the list of summed periodograms for micromobility trace*)*)
(*sumPeriodograms3*)
(*(*Plot the summed periodograms for 0.001*)*)
(*ListLinePlot[sumPeriodograms3,PlotRange->All,*)
(*PlotLabel->"Summed Periodograms for 0.001 micromobility",*)
(*AxesLabel->{"Segment Index","Sum of Periodogram "}]*)
(*(*Plot the summed periodograms with smaller dots and thinner lines*)ListPlot[sumPeriodograms3,Joined->True,PlotStyle->{Blue,Thin},PlotRange->All,PlotMarkers->{Automatic,Small},PlotLabel->"Summed Periodograms for 0.001 micromobility",AxesLabel->{"Segment Index","Sum of Periodogram "},ImageSize->Large]*)
(**)
(* ::Input:: *)
(*ListLinePlot[{sumPeriodograms3+101495,sumPeriodograms2},PlotRange->All,PlotStyle->{BlueGray},PlotLabel->"Summed Periodograms for 0.001 micromobility & blockage",PlotLegends->Placed[{"Micro in 0.001","Block in 0.001"},{0.2,0.9}]]*)
(* ::Input:: *)
(*(*Initialize the list to store the sum of periodograms with 0.0001 decay rate for blockage*)*)
(*sumPeriodograms4={};*)
(**)
(*(*Calculate the number of segments*)*)
(*numSegments4=Quotient[Length[movingAvg2],500];*)
(**)
(*(*Loop through each segment*)*)
(*For[i=1,i<=numSegments4,i++,*)
(*(*Extract the i^th segment of 500 values*)*)
(*blockSegment4=Take[movingAvg2,{500*(i-1)+1,500*i}];*)
(*(*Compute the periodogram for the current segment*)*)
(*periodogram4=PeriodogramArray[blockSegment4];*)
(*(*Sum up the values of the periodogram*)*)
(*sumPeriodogram4=Total[periodogram4];*)
(*(*Append the sum to the list*)*)
(*AppendTo[sumPeriodograms4,sumPeriodogram4];]*)
(**)
(*(*Output the list of summed periodograms for blockage trace*)*)
(*sumPeriodograms4*)
(*(*Plot the summed periodograms for 0.0001*)*)
(*ListLinePlot[sumPeriodograms4,PlotRange->All,*)
(*PlotLabel->"Summed Periodograms for 0.0001 blockage",*)
(*AxesLabel->{"Segment Index","Sum of Periodogram "}]*)
(*(*Plot the summed periodograms with smaller dots and thinner lines*)ListPlot[sumPeriodograms4,Joined->True,PlotStyle->{Blue,Thin},PlotRange->All,PlotMarkers->{Automatic,Small},PlotLabel->"Summed Periodograms for 0.0001 blockage",AxesLabel->{"Segment Index","Sum of Periodogram "},ImageSize->Large]*)
(* ::Input:: *)
(*(*Initialize the list to store the sum of periodograms with 0.0001 decay rate for micromobility*)*)
(*sumPeriodograms5={};*)
(**)
(*(*Calculate the number of segments*)*)
(*numSegments5=Quotient[Length[movingAvg4],500];*)
(**)
(*(*Loop through each segment*)*)
(*For[i=1,i<=numSegments5,i++,*)
(*(*Extract the i^th segment of 500 values*)*)
(*blockSegment5=Take[movingAvg4,{500*(i-1)+1,500*i}];*)
(*(*Compute the periodogram for the current segment*)*)
(*periodogram5=PeriodogramArray[blockSegment5];*)
(*(*Sum up the values of the periodogram*)*)
(*sumPeriodogram5=Total[periodogram5];*)
(*(*Append the sum to the list*)*)
(*AppendTo[sumPeriodograms5,sumPeriodogram5];]*)
(**)
(*(*Output the list of summed periodograms for micromobility trace*)*)
(*sumPeriodograms5*)
(*(*Plot the summed periodograms for 0.0001*)*)
(*ListLinePlot[sumPeriodograms5,PlotRange->All,*)
(*PlotLabel->"Summed Periodograms for 0.0001 micromobility",*)
(*AxesLabel->{"Segment Index","Sum of Periodogram "}]*)
(*(*Plot the summed periodograms with smaller dots and thinner lines*)ListPlot[sumPeriodograms5,Joined->True,PlotStyle->{Blue,Thin},PlotRange->All,PlotMarkers->{Automatic,Small},PlotLabel->"Summed Periodograms for 0.0001 micromobility",AxesLabel->{"Segment Index","Sum of Periodogram "},ImageSize->Large]*)
(* ::Input:: *)
(*ListLinePlot[{sumPeriodograms5+124249,sumPeriodograms4},PlotRange->{{0,165},All},PlotStyle->{BlueGray},PlotLabel->"Summed Periodograms for 0.0001 micromobility & blockage",PlotLegends->Placed[{"Micro in 0.0001","Block in 0.0001"},{0.2,0.8}]]*)