diff --git a/p1/data/dat-simulink.csv b/p1/data/dat-simulink.csv
deleted file mode 100644
index 6d9f234..0000000
--- a/p1/data/dat-simulink.csv
+++ /dev/null
@@ -1,502 +0,0 @@
-u,y
- 0, 1.16495351050
- 0.002437650102, 0.626839082632431
- 0.008395843283, 0.0750801546776829
- 0.015369616460, 0.351606902768522
- 0.022730589547, -0.696512535163682
- 0.028813760378, 1.69614248074708
- 0.036563856464, 0.0590597779813507
- 0.047318507723, 1.79707178369482
- 0.061147554372, 0.264068528817227
- 0.078163401976, 0.871673288690637
- 0.096261993907, -1.44617153933933
- 0.111735168943, -0.701165345682908
- 0.121565555451, 1.24598212043782
- 0.131725217197, -0.638976995013557
- 0.142211712999, 0.577350218771609
- 0.151681754307, -0.360029625711573
- 0.160716167547, -0.135576294466487
- 0.167886889755, -1.34933848038518
- 0.171231346696, -1.2704498962834
- 0.168693748945, 0.984570272925253
- 0.165562877141, -0.0448806138288563
- 0.164337412110, -0.798944516671106
- 0.161206391390, -0.765172428787515
- 0.154835418743, 0.861734897324192
- 0.148929917772, -0.056225124358975
- 0.144869306572, 0.513478173674302
- 0.141848472866, 0.396680865935824
- 0.140719553349, 0.756218970285488
- 0.141867363294, 0.400486023191097
- 0.145123629989, -1.34138072237857
- 0.145966826978, 0.375041023696104
- 0.144594656477, 1.12516181787503
- 0.146238434776, 0.728641591773905
- 0.151390958435, -2.37745429376543
- 0.152493584307, -0.2737824157439
- 0.147879344784, -0.322939921204497
- 0.142144179988, 0.317987915650739
- 0.136613961698, -0.511172207780701
- 0.130856756787, -0.00204134534943296
- 0.124267314965, 1.60651096111924
- 0.121318250836, 0.847648634500925
- 0.123461443513, 0.268100811901575
- 0.127579647734, -0.923489085784077
- 0.129853484698, -0.0704993877786937
- 0.129757114526, 0.147891351014747
- 0.129653919835, -0.557093642241282
- 0.128515569111, -0.336705699002853
- 0.125435688056, 0.415227462723156
- 0.122576085139, 1.55781353712321
- 0.123852754052, -2.44429889786556
- 0.122939016755, -1.09819538779932
- 0.114626505936, 1.12264785794487
- 0.106834248795, 0.581667258045274
- 0.102942874357, -0.271354295524753
- 0.099798533957, 0.414191307229504
- 0.097045619581, -0.9778142274614
- 0.093148932685, -1.02146617386615
- 0.085257131870, 0.317687979852042
- 0.076369479354, 1.51610779815003
- 0.071810788526, 0.749432452588256
- 0.072133335010, -0.507700386669636
- 0.072803128708, 0.885299448191509
- 0.074141500577, -0.248093553237236
- 0.076575157758, -0.726248999742084
- 0.076708895656, -0.445040300996161
- 0.074312512545, -0.612911120338436
- 0.069787044783, -0.209144084593638
- 0.063787378857, 0.562147834450359
- 0.058862329796, -1.06392288788104
- 0.053118019361, 0.351588948379816
- 0.046258309048, 1.13299992600868
- 0.042896890422, 0.149994248007729
- 0.042336929319, 0.703144053247466
- 0.043535001657, -0.0524115849986887
- 0.045917496951, 2.01849612400777
- 0.052189035471, 0.924159404893175
- 0.064014376318, -1.81411470285124
- 0.073028542853, 0.0349733202851668
- 0.077687106470, -1.80786206032125
- 0.078205955207, 1.02819254604578
- 0.077038781225, 0.394600308811932
- 0.078772419228, 0.639405642088516
- 0.082422167553, 0.874212894863609
- 0.088842433978, 1.75240173032956
- 0.100150745402, -0.320050826432137
- 0.113452326798, -0.137413808144866
- 0.124739049313, 0.615769628086716
- 0.136083452424, 0.977894069845197
- 0.149762606270, -1.11534771220514
- 0.161956532695, -0.550021448804486
- 0.169656722394, 0.0398848528457967
- 0.175551822103, -2.48284251425654
- 0.175684696865, 1.1586547052479
- 0.172917608577, -1.02627946669326
- 0.170322844067, 1.15348698823792
- 0.167988858787, -0.786456613020222
- 0.166295402297, 0.634808587961935
- 0.164210834664, 0.820409761532064
- 0.165057365382, -0.1760265104556
- 0.166925966004, 0.562473874646301
- 0.169252932089, -0.127442875395491
- 0.172068759188, 0.554171560978313
- 0.175352459051, -1.09734431922164
- 0.177004186748, -0.731301400074801
- 0.174525642752, 1.40473191961681
- 0.173422514001, -0.620214209475792
- 0.173728788728, 0.237148765008739
- 0.173003426288, -1.58684699003103
- 0.169253667587, -0.401484809800359
- 0.161446644087, -0.770692268923938
- 0.151522248966, -0.262680506066512
- 0.139948752978, 0.97648954365997
- 0.130486739789, 0.97781504112928
- 0.125538406346, 1.17002111026506
- 0.125204310822, 0.159310862415417
- 0.127444648766, 0.499520851464531
- 0.130725604793, -1.05537507065933
- 0.132412454344, -0.450743202815186
- 0.130700902499, 1.27037824216999
- 0.130664425803, 0.898693600923036
- 0.134926542239, 0.438705097860831
- 0.141463077026, -1.247344316402
- 0.145640317139, 0.324666916936102
- 0.147459533302, 0.390070410090458
- 0.150429647152, -0.405138316773605
- 0.152936896456, 0.29231487728345
- 0.154844331836, 2.56591024212381
- 0.162373215975, -0.457815643580367
- 0.173444067928, -1.61082701428916
- 0.179206551340, -2.6695237824109
- 0.175447462164, -0.759696648513815
- 0.164661475616, -0.674720856431937
- 0.151427948195, -1.17168719453355
- 0.135067581543, 2.0329300161552
- 0.121508676910, 0.968481047964462
- 0.114897302108, 0.67029199696923
- 0.111964731886, 0.420146041651794
- 0.111328699373, -2.87275126966852
- 0.105430307869, 1.68587408040699
- 0.097451100502, 0.0279245535239945
- 0.093390713809, -0.902030581228208
- 0.087651061950, -2.0532574915262
- 0.076046759587, 0.0890862976754639
- 0.061128674666, 2.08709913164975
- 0.051703984047, 0.365118460310679
- 0.047886206277, 0.846105526166482
- 0.046782095050, -0.184537657075523
- 0.047032271024, 1.03071442386955
- 0.048980062085, -1.52762265242938
- 0.049635535521, 0.964938959209115
- 0.049075197267, 0.526162503357523
- 0.051558436526, -0.184454117395808
- 0.054488526440, 0.198782828309268
- 0.057180571196, 1.59042683994639
- 0.063342317173, 0.0321916398987534
- 0.072308973385, 0.889163671412164
- 0.082484148658, -1.29915248991681
- 0.090942491967, 1.1825731043571
- 0.098512389634, 1.81747170621213
- 0.111643965373, -0.584302129859883
- 0.126207288037, -1.01067381655234
- 0.136283969412, -0.96049831249978
- 0.141403220568, 0.691159584398091
- 0.145458329680, -0.758618207013852
- 0.148858180576, -0.0969717327553058
- 0.150065480586, -1.40694904501744
- 0.147840514883, 1.03081245622456
- 0.144847329758, -0.759874404010818
- 0.142376987002, 0.874127225087956
- 0.140157148282, 0.761126995060121
- 0.141275833370, -0.165923454845674
- 0.143330622321, 0.300907437364548
- 0.145336788234, -0.322467327359368
- 0.146944367792, -0.368411284834508
- 0.146808772234, 1.14789527732987
- 0.148129334780, 0.0414302603415892
- 0.151586786956, -1.0980496536524
- 0.152383915314, 1.5667237455951
- 0.153950773334, -1.04842344829233
- 0.156204784867, 0.422723684679005
- 0.156830418858, -0.844414378203565
- 0.156293525717, -0.311629756199873
- 0.153200747174, 0.397810483954791
- 0.150305651236, 1.04978596179258
- 0.150412418065, -0.340795562628553
- 0.151736338000, 0.336296999435117
- 0.152767175115, -0.22136078228451
- 0.153740292939, 0.0166494938853639
- 0.154016925969, -1.19236123978469
- 0.151601182701, -0.131646296653231
- 0.146431214801, 1.48752430265133
- 0.144259421436, -0.836821230675096
- 0.143326824455, -1.30098190278336
- 0.137828804627, 1.57413185505183
- 0.133155409143, 1.16603996393892
- 0.134276893596, 0.786429694906372
- 0.139164064125, -1.4616387546644
- 0.142070893230, 1.5544659179464
- 0.144847678247, -0.597535383863608
- 0.149159188694, -1.21056787319236
- 0.149213833634, -0.702668798421263
- 0.145115185445, 0.356429388492137
- 0.140409126883, 0.652635669110502
- 0.137927833052, 0.215671160597416
- 0.137212237575, -0.263896185758453
- 0.136245286757, 1.80244023504604
- 0.138389545689, -0.642984171828691
- 0.142532611173, 0.109555050008099
- 0.145109035229, -0.719037696468626
- 0.146027075041, 0.42062757324897
- 0.146091498895, -1.93113368611571
- 0.142768659404, 0.660299784504416
- 0.136913941575, 0250959707945
- 0.130316257900, -0.102970644581647
- 0.121525577060, -1.05980153695263
- 0.110745352423, -1.23856593640737
- 0.095798488423, -1.88923605714065
- 0.075266047215, -0.973584554332184
- 0.050147893251, 0.212115838661386
- 0.025146751358, 0.493441990887632
- 0.003300379345, 1.54717659047233
--0.012798840152, 0.64493274830479
--0.023259792052, -2.14835899491811
--0.036145181528, -1.02884452543621
--0.054634945638, -0.141582115521168
--0.074173207421, -2.52670612285393
--0.097838690014, -0.312981492764229
--0.125555473247, -0.593617618531314
--0.153070087993, 0.332322161717666
--0.178994433943, 0.558850703293451
--0.201036462964, 0.899883573546132
--0.218256962314, -0.200898855586523
--0.232571131239, -0.233734974678244
--0.246477477930, 1.44990660185245
--0.256529039872, 1.83613202602166
--0.258729419507, -0.382918259160919
--0.257470999475, 0.155082744517634
--0.256402277551, -0.964648249056896
--0.256755399754, 0.0387564312898232
--0.258620144675, 0.765458387074111
--0.258318909656, -0.594524007839467
--0.257362335567, 0.130245975190898
--0.257059135844, 0.0350135051326026
--0.256083070313, -0.624674138678894
--0.256056842007, -0.539775240747624
--0.258085267418, 1.87995711256767
--0.256787179519, -1.00384945408178
--0.253483888809, -0.497445877674741
--0.253150888189, -1.50439715265069
--0.256656194612, -0.095449298936398
--0.262839625469, 0.396727053727293
--0.267599323196, -0.527114907886174
--0.271954360470, 0.344571055586828
--0.275990281756, -0.723290526415817
--0.280176932994, 1.26819336319293
--0.282512909723, -0.0312426582958191
--0.281772517871, 0.778211737167248
--0.279130159251, 2.18048355295766
--0.270132436477, 0.437813681537626
--0.256011191594, 1.33332898358725
--0.238825956004, 0.25107813911086
--0.219246474708, -0.31047090817812
--0.200851139533, -0.923003723808715
--0.186012782406, -0.384775736018753
--0.174631975962, 1.15818057089116
--0.162157703160, 0.862500188414089
--0.146148597273, -1.0347056249275
--0.131444438343, -0.192672883298642
--0.120090068300, -1.29972277987507
--0.112466215832, 0.306595916028864
--0.107227002444, 0.968992176157493
--0.099547087986, -0.747317126758189
--0.091843226234, -2.79602442297918
--0.091921437466, 0.696731553587482
--0.096122621866, 3.20690754366444
--0.091767663676, 0.536007044749823
--0.079912301146, 0.298450535720106
--0.067044346501, 0.284043160995206
--0.053766880031, 0.959664371348602
--0.038742145700, 2.08759311209632
--0.018370666205, 1.52468053170777
- 0.008077642447, -0.19526079003233
- 0.035398271230, 0.017260315800898
- 0.060423842076, 0.246340438601764
- 0.084191651893, -0.85448472108985
- 0.104920247870, 1.15778270176474
- 0.124751947167, 0.161907723250136
- 0.145748957434, 1.55706375548542
- 0.168686519827, -0.193543855158581
- 0.192586771017, 1.65130117445043
- 0.217633776060, 9877818089585
- 0.240054943325, 1.82252476317015
- 0.260533446237, -1.51841513419531
- 0.279787668565, -1.05107060879933
- 0.292026989384, 0.0499305134332341
- 0.300976857684, -1.45474886952808
- 0.305952803751, 0.466545849753956
- 0.308167761339, 0.545436841452861
- 0.311899783023, 1.32031907308504
- 0.318821767071, -0.404494327876404
- 0.326678395264, 0.418468509073849
- 0.333592212287, 0.247348749631458
- 0.340942137775, 0.704110315408186
- 0.349294101704, 0.631938853341633
- 0.359349774455, -0.992362112719315
- 0.367431551204, 1.76670836879512
- 0.376118825477, -0.382103635072939
- 0.386498999978, -0.911425420031351
- 0.392942893608, -0.99608998411821
- 0.394454280928, 1.19514263014412
- 0.395783246271, -0.159447782443431
- 0.398583314813, 2.70402604824876
- 0.405973222447, -0.198499915965497
- 0.417403676830, -0.141404614026417
- 0.426769249941, 0.411267926557381
- 0.435472498079, -1.17905965667049
- 0.441348592413, -0.277775505971886
- 0.443220810847, -1.58105341380234
- 0.440477048640, 1.04902234978446
- 0.436279772986, 0.302689036171394
- 0.434547190985, -1.2265023410583
- 0.430387020475, 0.0696000950977379
- 0.423559899164, -0.396516210293235
- 0.415932014924, 1.38880676152053
- 0.410352457004, 1.36442229049003
- 0.410284555190, 0.658152637292666
- 0.413820761084, 0.491313668926088
- 0.418915546015, 0.800733701087079
- 0.425761005345, -0.767268996676585
- 0.431578213797, 0.364419504046213
- 0.435594252607, -0.397913854767017
- 0.438644907186, 0.864279576409738
- 0.441876005683, -0.177618078276664
- 0.445669478722, 1.87438052046941
- 0.452146247219, 0.172400234691113
- 0.461743785855, 1.27174349438397
- 0.473056510182, -0.0353443679957601
- 0.485461757512, -1.50132883642184
- 0.493128844930, 0.365373411191592
- 0.497284510153, -0.19865985600102
- 0.500799006197, -1.38972170325751
- 0.500066943861, 0.229327812227314
- 0.496336276692, 0.27119023696723
- 0.493214588926, -0.366360220282281
- 0.489415672212, 1.37696039157049
- 0.487336648285, -0.797532756562798
- 0.485873766457, -0.936740611780525
- 0.480252236186, -0.00243346548885311
- 0.472437081466, 0.396086165525258
- 0.465333222315, -0.508693172275514
- 0.457822454974, -0.268285778746198
- 0.448597540250, -1.08214045362097
- 0.436577596965, 2.0141337202912
- 0.426787878929, 1.94403112557594
- 0.425267921866, -1.52152941634798
- 0.424054848947, 1.93931842629592
- 0.423289936067, -0.895840360657292
- 0.424082200489, -0.304157582743064
- 0.421768341982, 0.555253123177884
- 0.419572941733, -0.324246850701504
- 0.417406512035, 1.3388143671464
- 0.416952934661, 1.22229851347237
- 0.421249003940, -1.59597816278256
- 0.423826091105, -1.06773032044443
- 0.420146042384, -0.759919212299574
- 0.412368715760, 0.420988804468649
- 0.403887258791, -0.433373058325242
- 0.395387058365, 0.706251990240337
- 0.387520097282, 0.227856907314769
- 0.381581074778, -1.01699185125668
- 0.373862959073, 0.139860372563678
- 0.364376192207, -0.748088838235889
- 0.353761498896, -0.628974933137322
- 0.340546207120, 1.39483065417115
- 0.329405980136, -1.64769114004944
- 0.317981837602, -2.0149858438662
- 0.299323897204, 0.491716880786256
- 0.278451324949, -1.55497527509082
- 0.256384719111, -0.140609080683032
- 0.232014444932, 0.244943668795265
- 0.209229580576, -0.267458499968963
- 0.187667830310, -0.570245479900343
- 0.165594055120, -0.187266786888368
- 0.143256690341, 1.20855664796684
- 0.124407966076, -0.638854660397775
- 0.107819707025, 0.605540298516075
- 0.092188101299, -0.624480544088508
- 0.077437561426, 0.572228121730057
- 0.063518536522, -0.724410495952223
- 0.050124872846, 1.19219550553089
- 0.038599929052, 0.186746737068576
- 0.030642992921, 1.59493888226368
- 0.026911301935, 0.321307055691725
- 0.027330959813, 0.866840733181726
- 0.030154374588, 1.29184357610292
- 0.037215922358, 0.434312653452443
- 0.047287719465, -0.386206929335472
- 0.056679282967, -0.112563759811723
- 0.064320624244, -0.964333079249251
- 0.069098670754, -2.05725119297094
- 0.067176925245, 0.149996068326108
- 0.061405429160, 0.542037570810974
- 0.057387838287, 0.254408816480612
- 0.055207962718, -0.307240693819985
- 0.052979177728, -0.417111829581745
- 0.049330431108, 1.1368048328939
- 0.047391696994, 0.391313809093235
- 0.048662880478, 1.6051478186749
- 0.053937650853, 0.825892307356857
- 0.063782329232, 1.47039035572011
- 0.077624694166, -1.3789068923399
- 0.090524829029, -0.260172069009687
- 0.099049005217, 0.994768172763982
- 0.108398943305, 1.83403368186403
- 0.122825141588, -1.71591031873495
- 0.136244389832, 0.0869317058746623
- 0.145226591682, 1.95567435281059
- 0.157659225746, 0.161453769615341
- 0.173351221735, -0.628688359125364
- 0.186736845361, -1.43882446533843
- 0.194646978130, -0.0665959685875582
- 0.198664237024, 0.373380862806066
- 0.202775904797, 0.217314078186247
- 0.207542221532, -0.179456822070788
- 0.211762364776, 0.025672907009552
- 0.215086696037, 0.642066361973082
- 0.219281314662, 0.923086649379001
- 0.226127922443, -1.55510777372328
- 0.230822866118, 0.663594032788892
- 0.233087027541, -0.609499611051491
- 0.234954295816, 0.565239403309624
- 0.236306330140, -0.610781446255285
- 0.237116267057, 1.23111146649211
- 0.238871588598, 0.994299745127407
- 0.244772632045, -0.803474713644619
- 0.250279781594, -0.591204478397533
- 0.252183462287, 1.69154640779536
- 0.255939811467, 0.953355517329614
- 0.264535517552, -1.93005493739851
- 0.270083308508, 0.512844987283966
- 0.272005847961, 0.393682448572881
- 0.275292518897, -0.905426500446262
- 0.276882903002, -1.27447327679615
- 0.273465110156, 0.346546103379725
- 0.268027007640, -1.19523544023497
- 0.260801363047, 0.6672014423187
- 0.252668239643, -0.0677937745985269
- 0.245968872022, -1.73566010510706
- 0.235621886196, 0.806348573332824
- 0.223804248868, -0.914800737775521
- 0.212226120628, -0.514012560294795
- 0.198208850877, 1.89626061482575
- 0.187802288523, -0.253229992452281
- 0.181198886435, -0.174530598889962
- 0.173918291148, 0.978788421188577
- 0.168591331292, 1.28955367629478
- 0.168097468101, -0.530575044642476
- 0.168930578718, -0.692971494442308
- 0.166939239274, -0.859806234581962
- 0.161639988027, 0.529038063144839
- 0.155833421619, -0.227851983329631
- 0.150816496612, 0.376770329260843
- 0.146260339405, 1.22155618170185
- 0.145142567279, 1.09828777438716
- 0.148695862862, -0.853014335153324
- 0.152258374225, -0.904204301130295
- 0.151730434971, 0.698670395828124
- 0.150644157620, 0.482597708373328
- 0.151862480561, 0.811695978956173
- 0.155471994013, 0.32788264791102
- 0.160962938133, -1.58691667313653
- 0.163202796421, -0.920783046820398
- 0.159894056769, -0.614273757141473
- 0.153426232265, -0.334671554333678
- 0.145237358122, 0.0803446246354682
- 0.136897081984, -0.0475550782944156
- 0.129007693760, -0.614735621954271
- 0.120100837153, 0.240361970143272
- 0.110889319217, 0.125016815934406
- 0.102912664478, -0.223604591765641
- 0.095131576155, -0.391039478921063
- 0.086480621936, -1.38204535952843
- 0.074615915065, 1.07629163893956
- 0.062894520875, 1.26946565999934
- 0.056749939328, 0.487268352635843
- 0.054564157104, -0.956373570476764
- 0.051448249204, 0.45180747328207
- 0.047467505092, -1.25377763146753
- 0.041995388573, 0.256434631609721
- 0.034817410715, 0.421228929285213
- 0.029491641219, 1.04235979065273
- 0.027534160844, 1.20912040659216
- 0.030333540091, 0.780954540014887
- 0.037002797859, -1.17989975493881
- 0.042288047642, 1.00145005880789
- 0.046835336073, -1.02490474147858
- 0.050906197616, -1.05684555786868
- 0.050320670823, 2.88772349284138
- 0.053589257736, -0.267744313845742
- 0.061898740886, -0.488540043601896
- 0.067980725678, 0.419420246666344
diff --git a/p1/data/m.csv b/p1/data/m.csv
new file mode 100644
index 0000000..2d5421b
--- /dev/null
+++ b/p1/data/m.csv
@@ -0,0 +1,252 @@
+u,y
+-0.562081627343819,0
+-0.165028051084386,-0.0848846176713865
+0.402381188889212,-0.00855074782595819
+0.982074771068094,0.0465851901457117
+0.263269436202603,0.169762201014319
+-0.666985599169035,0.054323197496775
+0.973284224035816,0.051746560207838
+0.827634883964264,-0.0173133818174058
+-0.9682645974533,0.0719123061293299
+-0.38735633780591,0.20323870152281
+0.0746079511356577,0.169900711685989
+0.0688996822894083,-0.00746558140650048
+-0.574496970313833,0.138126734045196
+0.875794598774889,-0.141852647292507
+-0.000517935026678185,-0.0988200155700192
+-0.182466612748088,0.00240103076106294
+-0.361500652209623,-0.0595347187662052
+-0.59349933061446,-0.0519022350351849
+-0.8156527401021,-0.106703366966349
+-0.0953996614997273,-0.246702573251392
+-0.0574753429076985,-0.0275445682385667
+-0.121339358911542,0.129163048642404
+0.0748514826758073,0.318297851793095
+0.431284669521863,0.223248747689702
+-0.869612254141649,0.251157772434315
+0.0878966139107462,0.212505320828667
+-0.120548874661582,0.107255808344614
+-0.998809915035409,0.0807653257237951
+0.672839759696666,0.0145081167947413
+-0.837878405041005,0.0253975644329584
+0.56773040516662,-2.39532856761661e-05
+-0.727090123913758,-0.10795814297631
+-0.796725244166667,-0.0909358736412822
+0.266859813251933,0.00995070727841241
+0.107822691606275,-0.0372011713223269
+0.626531425689595,-0.0651091197686131
+0.0361671741288934,-0.0487676892938064
+-0.224337562557467,-0.109582017325756
+0.457216727294594,-0.178916504141863
+0.322710993384342,0.0309704863456593
+0.658477414240352,0.0506431803910415
+0.388047331659145,0.0623101077769065
+0.503420185997812,0.0359911107419933
+-0.673837888833991,0.0193161516424325
+0.0880454252884004,-0.0383760770110465
+-0.439422153606742,-0.0359387768251584
+-0.558629704433787,-0.112251115812661
+0.03997697263955,-0.284971509798976
+-0.337650089216256,-0.148524557670779
+0.152345922380847,-0.140875672976474
+0.228251039622468,-0.0889231511951012
+-0.496944804441624,0.0465610558784346
+0.331006910340398,0.082068516189644
+-0.834986920391669,-0.151454048215957
+0.868060945471777,-0.160252554385469
+0.51354035433081,0.00985996775878407
+-0.532617003439282,-0.0174954084308043
+-0.0316390735244561,-0.128508236942345
+0.038349728583521,-0.0465041726496238
+-0.589317382122072,-0.037358615065556
+-0.67983367558561,-0.104981843201757
+0.153551720619924,-0.142242202275461
+0.0790093499603726,0.114229214547889
+-0.7900617140299,-0.0504704387615806
+-0.234356993452812,-0.0328588411720029
+-0.149617799161755,-0.137465346004397
+-0.305016663533178,-0.0635402938976893
+-0.909318567211422,0.0122852168966604
+0.399381979088943,-0.0946668447025222
+-0.127807520855129,-0.106796103666498
+0.18317640162221,-0.0990174921556541
+0.933819305120883,-0.0797645616353446
+0.381545237908859,0.135080185084484
+-0.31277324692941,0.173661209205918
+0.47434979000797,-0.0215205041095453
+-0.556687081026233,-0.0835518038778322
+0.179618671154426,-0.118914977199466
+0.0386732691147706,0.125386697025116
+-0.805134915656007,0.11315801596806
+-0.697566219464674,0.101667350424666
+-0.785638963703829,-0.106680765663954
+-0.0266376952764754,-0.0479903373971647
+-0.44670607030704,0.0353016950643207
+0.566004670954312,0.0364743295471811
+0.303029073077733,0.116905291426555
+0.404942760898239,0.0893797830464027
+-0.32298081057285,-0.0612423559178996
+0.72921899693516,-0.190651431253798
+-0.238783399219989,-0.201157561505088
+0.838983901701394,-0.153230865999878
+-0.445603677744793,0.0208606856497355
+0.498290091519379,0.131139698572563
+0.75811975717457,0.169855697665016
+0.75638357352297,-0.0257884500341728
+0.375155796937251,0.131076064227461
+0.257533313360779,-0.0528647895038988
+-0.032254330363243,0.0931748927364773
+-0.839355925954578,0.0348971935198497
+-0.321761685107724,-0.0442452312895603
+-0.141054466898113,-0.0925317420305877
+-0.251501206891379,0.0607248465670675
+-0.220999071011785,0.0882657343519309
+0.204498790765413,0.00799784484065389
+-0.751218585181617,-0.0836631271887629
+0.58976151775092,-0.150354940379272
+-0.0699859154736557,-0.0668967855012146
+-0.413913108135533,-0.135652120956737
+-0.18842738363353,-0.0721416993785926
+0.666755671457739,-0.0501845048503642
+-0.442408544683088,0.06883040791009
+-0.300941884192145,0.193375560177824
+-0.765524363967369,0.180540303154666
+0.859780197897824,0.153550465624583
+-0.6740838939669,0.139042359806811
+0.334695734705169,0.168269259962125
+0.710164911910037,0.0473114765318522
+-0.816398257304168,-0.0132560118645178
+-0.13099439587956,0.00642581834123225
+-0.745824782990769,0.0280274330024728
+0.146800391910039,0.0114525145825461
+-0.763205443398657,0.0268220879521105
+0.456613086842286,-0.0141582162933872
+0.438408563583348,-0.127737166963499
+0.342703012443475,-0.147812633292664
+0.698135564894478,-0.0137274640231074
+-0.670800844054111,0.000513004189454612
+0.585560483665001,-0.0957600030634544
+0.151705400623244,-0.126140672877399
+0.495937946017803,-0.0587775919654244
+0.828736296775162,-0.113602753385482
+-0.275617057120249,0.0404169153674105
+-0.129249441963271,0.0637441027533635
+-0.496089479651344,0.0520406223713919
+-0.747938023762749,-0.0434250282438795
+-0.837347029632585,-0.148086186883691
+-0.717641319948082,-0.139919043048457
+-0.936323192872258,-0.0605219822362255
+-0.554920240098108,0.0474048568421955
+0.719021106939307,-0.0947218176526316
+-0.947999400062486,0.0261778777337991
+0.171600238034316,-0.0677998584179937
+0.826004394249061,-0.123032216818122
+0.387852175807512,0.194905723500561
+0.0351910223416942,0.166027166275701
+0.479863301608648,0.101954502130607
+0.444585834371199,-0.00212100636994374
+-0.0155852180978214,0.0424901518175131
+0.692872747635875,-0.020136542529367
+-0.300434749247709,0.14017545466314
+0.495401680234541,0.0467252671274352
+0.1432539257888,0.0518152607705747
+0.323782088851455,0.00891091382416525
+-0.48723274072969,0.0656228532554857
+0.460745400498037,-0.0912258739936947
+-0.349475199053751,-0.137388220950933
+0.984357650384474,-0.0464662361149723
+0.717022333162382,-0.0290631543902982
+-0.0847671390905823,0.0842585339781461
+0.89878820343818,0.0387303686119073
+0.628449186509684,0.0326745671195254
+-0.6684710158354,0.100022791409108
+-0.353190103244591,-0.120791479513615
+0.883962914293615,-0.148576945580147
+-0.277615144512437,-0.184046870106486
+0.0948024723188963,-0.136855716266544
+-0.335375443722762,0.0311153392168198
+0.780905995415946,-0.0224553304744231
+0.0511205489985276,0.0788479869635113
+0.241345313955725,-0.0500833323004902
+0.851539127459535,-0.112609714052497
+-0.291347311479667,-0.132830197510762
+-0.843571841643924,-0.194825060471202
+-0.996671304105162,-0.218432230330827
+0.921911736913916,-0.159673404773765
+0.764604230301736,-0.199288865578464
+-0.532099923832389,0.116195428966659
+0.283330017367066,0.157707373781633
+0.258282310915311,0.140041359684938
+-0.935322373144013,0.196915951661411
+-0.830454336400355,0.120386701590254
+0.374635382264217,0.101826502163638
+0.821705620652859,0.209094203434554
+0.613403443067057,0.10826422633432
+-0.956468232887084,0.0569546117630172
+-0.186500359879108,0.172972783266203
+0.376801843464748,0.0341815581906813
+0.59207610860098,0.0638312199981932
+-0.037140366172949,-0.0440596218668656
+-0.434475232583692,0.0249241103881933
+-0.291389503186284,-0.037444191519866
+-0.0601084125508128,-0.10827784318051
+0.784298201922466,-0.233941733889692
+0.0130897644036867,-0.0292668767208536
+-0.471272126525302,-0.132352153493435
+-0.43183794684328,-0.0285887256597882
+-0.959193706493449,0.0195679991308332
+-0.913185525645123,0.145244999346624
+-0.414255243453316,0.0752718384166183
+0.363312282303028,0.076558551495326
+0.743653144568043,-0.0967207911101528
+-0.334610971312323,-0.057695839272927
+0.683896947504905,0.220457065560355
+0.381545025567312,0.249105557222865
+-0.480161357428954,0.218030510334781
+0.304930325273858,0.0644631852618431
+0.562712400948029,-0.0138504593059087
+-0.498690735315294,0.0493680673636072
+0.917412161788629,0.0829444150386858
+-0.0910431757061944,0.212697184586624
+-0.639183673839636,0.230104278405291
+-0.139293632069274,0.159652227148624
+0.722858748269667,0.0954345880223326
+-0.576794941712541,0.207757724506451
+0.931673358162713,-0.0422537892114052
+0.335037476073502,0.121191599709049
+-0.526334091800421,0.135758709437636
+-0.852575754678145,0.0466947927713023
+-0.609541804347905,0.125927079414675
+0.671690425682669,-0.0078502938544791
+0.0763494088670003,-0.0585132867888244
+0.0892805201417211,-0.175864475624874
+-0.323095335309904,-0.154157927887642
+-0.174369967158125,0.0522737524138117
+-0.524507459962977,0.0783792135121095
+0.957202981206217,0.0897387931304263
+0.813413716765779,0.0596736907760852
+0.283293277622803,0.0372312933723317
+0.513900782686612,-0.150468366623803
+0.395650216096849,-0.147955284625277
+-0.0823185420978435,-0.0223826480219779
+0.1341197896442,-0.0280534253211324
+0.0899726520711428,0.0513034519514842
+0.817904155616604,8.59935647047512e-05
+-0.656541830700143,-0.0351927114589313
+-0.151372477017051,-0.0139098899105425
+0.475657624879692,-0.0687908511025121
+-0.941745635094934,-0.0620316597861909
+0.0241828938127415,-0.0424930929299225
+-0.0225139358185762,0.151388215635737
+-0.100346996961323,0.154763082869366
+0.193473809954465,0.0271937744025612
+0.640271583404519,0.0105602365003001
+0.59476472232247,0.0572940959449519
+0.30324439671973,-0.0612133530446115
+-0.993561718609911,0.0921513064661191
+-0.246076793058811,-0.000518372223260732
+0.923166690358504,0.0650959749032007
+-0.856037346579152,0.0681306364260466
+-0.453166298313609,-0.103159953315381
+0.572474384481308,-0.116014111229541
+-0.435653748659256,-0.0938795633662015
diff --git a/p1/img/autocorrelation_u.jpg b/p1/img/autocorrelation_u.jpg
new file mode 100644
index 0000000..6b376b1
Binary files /dev/null and b/p1/img/autocorrelation_u.jpg differ
diff --git a/p1/img/autocorrelation_y.jpg b/p1/img/autocorrelation_y.jpg
new file mode 100644
index 0000000..ded9fba
Binary files /dev/null and b/p1/img/autocorrelation_y.jpg differ
diff --git a/p1/img/autocovariance_u.jpg b/p1/img/autocovariance_u.jpg
new file mode 100644
index 0000000..37ac525
Binary files /dev/null and b/p1/img/autocovariance_u.jpg differ
diff --git a/p1/img/autocovariance_y.jpg b/p1/img/autocovariance_y.jpg
new file mode 100644
index 0000000..2287411
Binary files /dev/null and b/p1/img/autocovariance_y.jpg differ
diff --git a/p1/img/cdf_u.jpg b/p1/img/cdf_u.jpg
new file mode 100644
index 0000000..1d4cdce
Binary files /dev/null and b/p1/img/cdf_u.jpg differ
diff --git a/p1/img/cdf_y.jpg b/p1/img/cdf_y.jpg
new file mode 100644
index 0000000..e60d0f0
Binary files /dev/null and b/p1/img/cdf_y.jpg differ
diff --git a/p1/img/hist_u.jpg b/p1/img/hist_u.jpg
new file mode 100644
index 0000000..d4e759e
Binary files /dev/null and b/p1/img/hist_u.jpg differ
diff --git a/p1/img/hist_y.jpg b/p1/img/hist_y.jpg
new file mode 100644
index 0000000..36a5c29
Binary files /dev/null and b/p1/img/hist_y.jpg differ
diff --git a/p1/img/matOutU.svg b/p1/img/matOutU.svg
new file mode 100644
index 0000000..99ef47b
--- /dev/null
+++ b/p1/img/matOutU.svg
@@ -0,0 +1,154 @@
+
+
+
diff --git a/p1/img/matOutY.svg b/p1/img/matOutY.svg
new file mode 100644
index 0000000..b9f7d39
--- /dev/null
+++ b/p1/img/matOutY.svg
@@ -0,0 +1,118 @@
+
+
+
diff --git a/p1/img/model.png b/p1/img/model.png
new file mode 100644
index 0000000..bda179a
Binary files /dev/null and b/p1/img/model.png differ
diff --git a/p1/img/mutual_corellation_uy.jpg b/p1/img/mutual_corellation_uy.jpg
deleted file mode 100644
index 0a61141..0000000
Binary files a/p1/img/mutual_corellation_uy.jpg and /dev/null differ
diff --git a/p1/img/mutual_correlation_uy.jpg b/p1/img/mutual_correlation_uy.jpg
new file mode 100644
index 0000000..8993112
Binary files /dev/null and b/p1/img/mutual_correlation_uy.jpg differ
diff --git a/p1/img/mutual_correlation_yu.jpg b/p1/img/mutual_correlation_yu.jpg
new file mode 100644
index 0000000..3559ffe
Binary files /dev/null and b/p1/img/mutual_correlation_yu.jpg differ
diff --git a/p1/img/mutual_covariance_uy.jpg b/p1/img/mutual_covariance_uy.jpg
deleted file mode 100644
index 81be012..0000000
Binary files a/p1/img/mutual_covariance_uy.jpg and /dev/null differ
diff --git a/p1/img/samplecount.png b/p1/img/samplecount.png
new file mode 100644
index 0000000..e844874
Binary files /dev/null and b/p1/img/samplecount.png differ
diff --git a/p1/img/signal_u.jpg b/p1/img/signal_u.jpg
new file mode 100644
index 0000000..645fd28
Binary files /dev/null and b/p1/img/signal_u.jpg differ
diff --git a/p1/img/signal_y.jpg b/p1/img/signal_y.jpg
new file mode 100644
index 0000000..6977021
Binary files /dev/null and b/p1/img/signal_y.jpg differ
diff --git a/p1/img/step_response.png b/p1/img/step_response.png
new file mode 100644
index 0000000..dfd02e4
Binary files /dev/null and b/p1/img/step_response.png differ
diff --git a/p1/img/u_autocorellation.jpg b/p1/img/u_autocorellation.jpg
deleted file mode 100644
index 55580a2..0000000
Binary files a/p1/img/u_autocorellation.jpg and /dev/null differ
diff --git a/p1/img/u_autocovariance.jpg b/p1/img/u_autocovariance.jpg
deleted file mode 100644
index 50c97ec..0000000
Binary files a/p1/img/u_autocovariance.jpg and /dev/null differ
diff --git a/p1/img/u_dist.jpg b/p1/img/u_dist.jpg
deleted file mode 100644
index 3eac794..0000000
Binary files a/p1/img/u_dist.jpg and /dev/null differ
diff --git a/p1/img/u_hist.jpg b/p1/img/u_hist.jpg
deleted file mode 100644
index e4b876b..0000000
Binary files a/p1/img/u_hist.jpg and /dev/null differ
diff --git a/p1/img/u_input_plot.jpg b/p1/img/u_input_plot.jpg
deleted file mode 100644
index 721fe17..0000000
Binary files a/p1/img/u_input_plot.jpg and /dev/null differ
diff --git a/p1/img/y_autocorellation.jpg b/p1/img/y_autocorellation.jpg
deleted file mode 100644
index 2d664df..0000000
Binary files a/p1/img/y_autocorellation.jpg and /dev/null differ
diff --git a/p1/img/y_autocovariance.jpg b/p1/img/y_autocovariance.jpg
deleted file mode 100644
index 00292cd..0000000
Binary files a/p1/img/y_autocovariance.jpg and /dev/null differ
diff --git a/p1/img/y_dist.jpg b/p1/img/y_dist.jpg
deleted file mode 100644
index 8ce34e8..0000000
Binary files a/p1/img/y_dist.jpg and /dev/null differ
diff --git a/p1/img/y_hist.jpg b/p1/img/y_hist.jpg
deleted file mode 100644
index 41c5d10..0000000
Binary files a/p1/img/y_hist.jpg and /dev/null differ
diff --git a/p1/img/y_input_plot.jpg b/p1/img/y_input_plot.jpg
deleted file mode 100644
index b269d65..0000000
Binary files a/p1/img/y_input_plot.jpg and /dev/null differ
diff --git a/p1/matlab/p1-randn_transferfunc.mat b/p1/matlab/p1-randn_transferfunc.mat
deleted file mode 100644
index 6f832c9..0000000
Binary files a/p1/matlab/p1-randn_transferfunc.mat and /dev/null differ
diff --git a/p1/matlab/p1-randn_transferfunc.mldatx b/p1/matlab/p1-randn_transferfunc.mldatx
deleted file mode 100644
index babf393..0000000
Binary files a/p1/matlab/p1-randn_transferfunc.mldatx and /dev/null differ
diff --git a/p1/matlab/p1-simout.xlsx b/p1/matlab/p1-simout.xlsx
deleted file mode 100644
index afd7681..0000000
Binary files a/p1/matlab/p1-simout.xlsx and /dev/null differ
diff --git a/p1/matlab/p1.m b/p1/matlab/p1.m
new file mode 100644
index 0000000..b1bc42f
--- /dev/null
+++ b/p1/matlab/p1.m
@@ -0,0 +1,10 @@
+step(1, [2 5 1])
+length(out.u);
+length(out.y);
+
+cd ~/src/utb/ak9im/ak9im/p1/data/;
+
+m = [out.u,out.y];
+m;
+
+% writematrix(m, 'm.csv');
diff --git a/p1/matlab/p1.mat b/p1/matlab/p1.mat
new file mode 100644
index 0000000..72e7def
Binary files /dev/null and b/p1/matlab/p1.mat differ
diff --git a/p1/matlab/p1.slx b/p1/matlab/p1.slx
new file mode 100644
index 0000000..edfcf48
Binary files /dev/null and b/p1/matlab/p1.slx differ
diff --git a/p1/p1/funcs.py b/p1/p1/funcs.py
index 6f53954..fb0222a 100644
--- a/p1/p1/funcs.py
+++ b/p1/p1/funcs.py
@@ -11,16 +11,14 @@ def load_d(path: str) -> pd.DataFrame():
return pd.read_csv(path, float_precision='round_trip', dtype='float64')
-def plot_d(dat: pd.Series, fname: str = 'plot_input_data', colour: str = ''):
- if colour == '':
- colour = 'blue'
-
- pyplt.plot(dat, color=colour)
+def plot_d(dat: pd.Series, fname: str = 'x', colour: str = '#1f77b4'):
pyplt.xlim(0, len(dat))
pyplt.ylim(min(dat) - 0.3, max(dat) + 0.3)
pyplt.xticks(size=plt_ticks_size())
pyplt.yticks(size=plt_ticks_size())
- pyplt.savefig(fname + '.jpg')
+ pyplt.title('Signal ' + fname)
+ pyplt.plot(dat, color=colour)
+ pyplt.savefig('signal_' + fname + '.jpg')
# pplt.show(block=0)
# rework this
# ref: https://stackoverflow.com/a/46418284
@@ -35,17 +33,28 @@ def variance(dat: pd.Series) -> float:
return sum(pow(dat - mean(dat), 2)) / len(dat)
-def histogram(dat: pd.Series, bins: int = 10, fname: str = 'hist', colour: str = 'blue'):
- pyplt.hist(dat, color=colour, bins=bins)
+def histogram(dat: pd.Series, bins: int = 10, fname: str = 'x', colour: str = '#1f77b4'):
+ pyplt.title('Histogram of ' + fname)
+ pyplt.xlabel(fname)
+ pyplt.ylabel('probability')
+
+ pyplt.hist(dat, color=colour, bins=bins, edgecolor='black')
pyplt.xticks(size=plt_ticks_size())
pyplt.yticks(size=plt_ticks_size())
- pyplt.savefig(fname + '.jpg')
+ pyplt.savefig('hist_' + fname + '.jpg')
pyplt.close()
-def distr_func(dat: pd.Series, fname: str = 'dist', colour: str = 'blue'):
- dat.plot.density(color=colour)
- pyplt.savefig(fname + '.jpg')
+def distr_func(dat: pd.Series, bins: int = 20, fname: str = 'x', colour: str = '#1f77b4'):
+ N = len(dat)/bins
+ x = np.sort(dat)[::bins]
+ y = np.arange(1, N+1) / float(N)
+
+ pyplt.xlabel(fname)
+ pyplt.ylabel('probability')
+ pyplt.title('Cumulative Distribution Function of ' + fname)
+ pyplt.hist(dat, bins=bins, cumulative=True, density=1, color=colour)
+ pyplt.savefig('cdf_' + fname + '.jpg')
pyplt.close()
@@ -62,30 +71,31 @@ def covar(dat: pd.DataFrame) -> float:
return dat['u'].dot(dat['y']) / len(dat)
-def correl_coeff(cov: float, std_dev_u: float, std_dev_y: float) -> float:
+def correlation_coefficient(cov: float, std_dev_u: float, std_dev_y: float) -> float:
return cov / (std_dev_u * std_dev_y)
-# m is the max permissible shift value.
-def auto_corellation(dat: list, max_shift_n: int = .1) -> float:
+def auto_covariance(dat: list, max_shift_n: int = .1) -> list:
v = []
+ # m is the max permissible shift value.
m = len(dat) * max_shift_n
+ mean = np.mean(dat)
cur_shift = 0
while m >= cur_shift:
r = 0
for i in range(len(dat) - cur_shift):
- r += dat[i] * dat[i + cur_shift]
+ r += (dat[i] - mean) * (dat[i + cur_shift] - mean)
- r = r / len(dat) - cur_shift
+ r = r * (1 / len(dat) - cur_shift)
v.append(r)
cur_shift += 1
return v
-def mutual_corellation(dx: list, dy: list, max_shift_n: int = .1) -> float:
+def mutual_correlation(dx: list, dy: list, max_shift_n: int = .1) -> list:
v = []
m = len(dx) * max_shift_n
cur_shift = 0
@@ -96,16 +106,15 @@ def mutual_corellation(dx: list, dy: list, max_shift_n: int = .1) -> float:
for i in range(len(dx) - cur_shift):
r += dx[i] * dy[i + cur_shift]
- r = r / (len(dx) - cur_shift)
+ r = r * (1 / (len(dx) - cur_shift))
v.append(r)
cur_shift += 1
return v
-def auto_covar(dat: list, max_shift_n: int = .1) -> float:
+def auto_correlation(dat: list, max_shift_n: int = .1) -> list:
v = []
- mean = np.mean(dat)
m = len(dat) * max_shift_n
cur_shift = 0
@@ -113,19 +122,19 @@ def auto_covar(dat: list, max_shift_n: int = .1) -> float:
r = 0
for i in range(len(dat) - cur_shift):
- r += (dat[i] - mean) * (dat[i + cur_shift] - mean)
+ r += dat[i] * dat[i + cur_shift]
- r = r / (len(dat) - cur_shift)
+ r = r * (1 / (len(dat) - cur_shift))
v.append(r)
cur_shift += 1
return v
-def mutual_covar(dx: list, dy: list, max_shift_n: int = .1) -> float:
+def mutual_covar(dx: list, dy: list, max_shift_n: int = .1) -> list:
v = []
- mean_x, mean_y = np.mean(dx), np.mean(dy)
m = len(dx) * max_shift_n
+ mean_x, mean_y = np.mean(dx), np.mean(dy)
cur_shift = 0
while m >= cur_shift:
@@ -134,36 +143,49 @@ def mutual_covar(dx: list, dy: list, max_shift_n: int = .1) -> float:
for i in range(len(dx) - cur_shift):
r += (dx[i] - mean_x) * (dy[i + cur_shift] - mean_y)
- r = r / (len(dx) - cur_shift)
+ r = r / (len(dx) - 1 - cur_shift)
v.append(r)
cur_shift += 1
return v
-def plot_autocorellation(dat: pd.DataFrame, fname: str = 'autocorellation', colour: str = 'blue'):
- d = auto_corellation(dat.tolist())
- pyplt.scatter(range(0, len(d)), d, color=colour)
- pyplt.savefig(fname + '.jpg')
+def plot_autocovariance(dat: pd.DataFrame, fname: str = 'x', colour: str = '#1f77b4'):
+ d = auto_covariance(dat.tolist())
+ pyplt.plot(range(0, len(d)), d, color=colour)
+ pyplt.title('Autocovariance of ' + fname + ' (C' + fname + fname + ')')
+ pyplt.xlabel('shift')
+ pyplt.ylabel('C' + fname + fname)
+ pyplt.savefig('autocovariance_' + fname + '.jpg')
pyplt.close()
-def plot_mutual_corellation(d1: pd.DataFrame, d2: pd.DataFrame, fname: str = 'mutcorellation', colour: str = 'blue'):
- d = mutual_corellation(d1.tolist(), d2.tolist())
- pyplt.scatter(range(0, len(d)), d, color=colour)
- pyplt.savefig(fname + '.jpg')
+def plot_mutual_correlation(d1: pd.DataFrame, d2: pd.DataFrame, fname: str = 'xy', colour: str = '#1f77b4'):
+ d = mutual_correlation(d1.tolist(), d2.tolist())
+ pyplt.plot(range(0, len(d)), d, color=colour)
+ pyplt.title('Mutual correlation of ' + fname + ' (R' + fname + ')')
+ pyplt.xlabel('shift')
+ pyplt.ylabel('R' + fname)
+ pyplt.savefig('mutual_correlation_' + fname + '.jpg')
pyplt.close()
-def plot_autocovariance(dat: pd.DataFrame, fname: str = 'autocovariance', colour: str = 'blue'):
- d = auto_covar(dat.tolist())
- pyplt.scatter(range(0, len(d)), d, color=colour)
- pyplt.savefig(fname + '.jpg')
+def plot_autocorrelation(dat: pd.DataFrame, fname: str = 'x', colour: str = '#1f77b4'):
+ d = auto_correlation(dat.tolist())
+ pyplt.plot(range(0, len(d)), d, color=colour)
+ pyplt.title('Autocorrelation of ' + fname + ' (R' + fname + fname + ')')
+ pyplt.xlabel('shift')
+ pyplt.ylabel('R' + fname + fname)
+ pyplt.savefig('autocorrelation_' + fname + '.jpg')
pyplt.close()
-def plot_mutual_covariance(d1: pd.DataFrame, d2: pd.DataFrame, fname: str = 'mutcovariance', colour: str = 'blue'):
+def plot_mutual_covariance(d1: pd.DataFrame, d2: pd.DataFrame, fname: str = 'xy', colour: str = '#1f77b4'):
d = mutual_covar(d1.tolist(), d2.tolist())
- pyplt.scatter(range(0, len(d)), d, color=colour)
- pyplt.savefig(fname + '.jpg')
+ # pyplt.scatter(range(0, len(d)), d, color=colour)
+ pyplt.plot(range(0, len(d)), d, color=colour)
+ pyplt.title('Mutual covariance of ' + fname + '(C' + fname + fname + ')')
+ pyplt.xlabel('shift')
+ pyplt.ylabel('C' + fname)
+ pyplt.savefig('mutual_covariance_' + fname + '.jpg')
pyplt.close()
diff --git a/p1/p1/main.py b/p1/p1/main.py
index f774de9..c22803e 100644
--- a/p1/p1/main.py
+++ b/p1/p1/main.py
@@ -28,11 +28,14 @@ def main(argv):
# d = d.astype('float64')
print(d.head(), '\n')
+ # alternative colour used to differentiate from the default.
+ altcol = '#ff7f0e'
+
# data plots
du = d['u']
dy = d['y']
- f.plot_d(du, fname='u_input_plot')
- f.plot_d(dy, fname='y_input_plot', colour='green')
+ f.plot_d(du, fname='u')
+ f.plot_d(dy, fname='y', colour=altcol)
# mean and variance
mean_u = f.mean(d['u'])
@@ -45,33 +48,36 @@ def main(argv):
print('variance u:', variance_u)
print('variance y:', variance_y)
- hist_u = f.histogram(d['u'], fname='u_hist')
- hist_y = f.histogram(d['y'], fname='y_hist', colour='green')
+ f.histogram(d['u'], fname='u')
+ f.histogram(d['y'], fname='y', colour=altcol)
- dist_u = f.distr_func(d['u'], fname='u_dist')
- dist_y = f.distr_func(d['y'], fname='y_dist', colour='green')
+ f.distr_func(d['u'], fname='u')
+ f.distr_func(d['y'], fname='y', colour=altcol)
cov = f.covar(d)
std_dev_u = f.std_dev(d['u'])
std_dev_y = f.std_dev(d['y'])
# correlation coefficient
- correl_c = f.correl_coeff(cov, std_dev_u, std_dev_y)
- print("correlation coefficient:", correl_c)
+ rUY = f.correlation_coefficient(cov, std_dev_u, std_dev_y)
+ print("correlation coefficient rUY:", rUY)
- print("covariance matrix (built-in):\n", d.cov())
+ print("covariance matrix (built-in):\n", d.cov(), '\n')
# print the covariance matrix.
- print("covariance matrix (own):\n")
+ print("covariance matrix (own):")
print(np.array([[variance_u, cov], [cov, variance_y]]))
- f.plot_autocorellation(dat=d['u'], fname='u_autocorellation')
- f.plot_autocorellation(dat=d['y'], fname='y_autocorellation', colour='green')
+ f.plot_autocorrelation(dat=d['u'], fname='u')
+ f.plot_autocorrelation(dat=d['y'], fname='y', colour=altcol)
- f.plot_mutual_corellation(d1=d['u'], d2=d['y'], fname='mutual_corellation_uy')
+ f.plot_mutual_correlation(d1=d['u'], d2=d['y'], fname='uy')
+ f.plot_mutual_correlation(d1=d['y'], d2=d['u'], fname='yu')
- f.plot_autocovariance(dat=d['u'], fname='u_autocovariance')
- f.plot_autocovariance(dat=d['y'], fname='y_autocovariance', colour='green')
+ f.plot_autocovariance(dat=d['u'], fname='u')
+ f.plot_autocovariance(dat=d['y'], fname='y', colour=altcol)
- f.plot_mutual_covariance(d1=d['u'], d2=d['y'], fname='mutual_covariance_uy')
+ # we don't need this atm.
+ # f.plot_mutual_covariance(d1=d['u'], d2=d['y'], fname='uy')
+ # f.plot_mutual_covariance(d1=d['y'], d2=d['u'], fname='yu')
if __name__ == "__main__":