Rev 4429 Rev 4666
Line 1... Line 1...
1 { 1 {
2 "metadata": { 2 "metadata": {
3 "name": "", 3 "name": "",
4 "signature": "sha256:c35f5f2963a30c62e2bc2437fc0d2422404aec0dbc3c5526df0be8cecdef27ee" 4 "signature": "sha256:9453f2d297004717b7b0ab5bb80d8d05d3ff319f7e609fa9565e753aa36cef87"
5 }, 5 },
6 "nbformat": 3, 6 "nbformat": 3,
7 "nbformat_minor": 0, 7 "nbformat_minor": 0,
8 "worksheets": [ 8 "worksheets": [
9 { 9 {
Line 48... Line 48...
48 "text": [ 48 "text": [
49 "36.7822\n" 49 "36.7822\n"
50 ] 50 ]
51 } 51 }
52 ], 52 ],
53 "prompt_number": 24 53 "prompt_number": 3
54 }, 54 },
55 { 55 {
56 "cell_type": "code", 56 "cell_type": "code",
57 "collapsed": false, 57 "collapsed": false,
58 "input": [ 58 "input": [
Line 61... Line 61...
61 "plt.show()" 61 "plt.show()"
62 ], 62 ],
63 "language": "python", 63 "language": "python",
64 "metadata": {}, 64 "metadata": {},
65 "outputs": [], 65 "outputs": [],
66 "prompt_number": 14 66 "prompt_number": 4
67 }, 67 },
68 { 68 {
69 "cell_type": "code", 69 "cell_type": "code",
70 "collapsed": false, 70 "collapsed": false,
71 "input": [ 71 "input": [
72 "prev_val= dataset.value[0,2]\n", 72 "prev_val= dataset.value[0,2]\n",
73 "n = 0\n", 73 "n = 0\n",
74 "angle = np.zeros_like(dataset.value)\n", 74 "angle = np.zeros((dataset.shape[0]))\n",
75 "for i in range(dataset.value.shape[0]):\n", 75 "for i in range(dataset.value.shape[0]):\n",
76 " if (dataset.value[i,2] - prev_val) > 300: \n", 76 " if (dataset.value[i,2] - prev_val) > 300:\n",
-   77 " n -= 1\n",
-   78 " angle[i] = dataset.value[i,2] + n*360\n",
-   79 " prev_val = dataset.value[i,2]\n",
-   80 " elif -(dataset.value[i,2] - prev_val) > 300: # compute angular speed in backward direction.\n",
77 " n += 1\n", 81 " n += 1\n",
-   82 " angle[i] = dataset.value[i,2] - n*360\n",
-   83 " prev_val = dataset.value[i,2]\n",
-   84 " else:\n",
78 " angle[i] = dataset.value[i,2] + n*360\n", 85 " angle[i] = dataset.value[i,2] + n*360\n",
79 " prev_val = dataset.value[i,2]" 86 " prev_val = dataset.value[i,2]\n",
-   87 " "
-   88 ],
-   89 "language": "python",
-   90 "metadata": {},
-   91 "outputs": [],
-   92 "prompt_number": 6
-   93 },
-   94 {
-   95 "cell_type": "markdown",
-   96 "metadata": {},
-   97 "source": [
-   98 "Five point difference numerical calculation. Source: http://mathfun528.blogspot.cz/2011/07/numerical-differentiation.html"
-   99 ]
-   100 },
-   101 {
-   102 "cell_type": "code",
-   103 "collapsed": false,
-   104 "input": [
-   105 "angle_speed = np.zeros_like(angle)\n",
-   106 "\n",
-   107 "for i in range(2,angle.shape[0]-2):\n",
-   108 " angle_speed[i] = (-angle[i + 2] + 8*angle[i + 1] - 8*angle[i - 1] + angle[i - 2])/12"
80 ], 109 ],
81 "language": "python", 110 "language": "python",
82 "metadata": {}, 111 "metadata": {},
83 "outputs": [], 112 "outputs": [],
84 "prompt_number": 19 113 "prompt_number": 7
85 }, 114 },
86 { 115 {
87 "cell_type": "code", 116 "cell_type": "code",
88 "collapsed": false, 117 "collapsed": false,
89 "input": [ 118 "input": [
-   119 "fig, ax1 = plt.subplots()\n",
-   120 "\n",
-   121 "ax2 = ax1.twinx()\n",
-   122 "ax1.set_xlabel('Sample #')\n",
-   123 "ax1.set_ylabel('Angle')\n",
-   124 "ax2.set_ylabel('Angular speed')\n",
-   125 "\n",
-   126 "ax1.plot(dataset.value[:,0], angle,'b',dataset.value[:,0], dataset.value[:,2],'r')\n",
-   127 "ax2.plot(dataset.value[:,0], angle_speed,'g')\n",
-   128 "\n",
-   129 "plt.show()"
-   130 ],
-   131 "language": "python",
-   132 "metadata": {},
-   133 "outputs": [],
-   134 "prompt_number": 8
-   135 },
-   136 {
-   137 "cell_type": "code",
-   138 "collapsed": false,
-   139 "input": [
90 "angle" 140 "print angle"
91 ], 141 ],
92 "language": "python", 142 "language": "python",
93 "metadata": {}, 143 "metadata": {},
94 "outputs": [ 144 "outputs": [
95 { 145 {
96 "metadata": {}, -  
97 "output_type": "pyout", 146 "output_type": "stream",
98 "prompt_number": 20, 147 "stream": "stdout",
99 "text": [ 148 "text": [
100 "array([[ 0., 0., 0.],\n", -  
101 " [ 0., 0., 0.],\n", -  
102 " [ 0., 0., 0.],\n", -  
103 " ..., \n", -  
104 " [ 0., 0., 0.],\n", 149 "[ 3.64746094e+01 3.65405273e+01 3.77929688e+01 ..., -1.31529551e+05\n",
105 " [ 0., 0., 0.],\n", -  
106 " [ 0., 0., 0.]], dtype=float32)" 150 " -1.31530452e+05 -1.31528452e+05]\n"
107 ] 151 ]
108 } 152 }
109 ], 153 ],
110 "prompt_number": 20 154 "prompt_number": 10
-   155 },
-   156 {
-   157 "cell_type": "code",
-   158 "collapsed": false,
-   159 "input": [],
-   160 "language": "python",
-   161 "metadata": {},
-   162 "outputs": [],
-   163 "prompt_number": 4
-   164 },
-   165 {
-   166 "cell_type": "markdown",
-   167 "metadata": {},
-   168 "source": []
-   169 },
-   170 {
-   171 "cell_type": "code",
-   172 "collapsed": false,
-   173 "input": [],
-   174 "language": "python",
-   175 "metadata": {},
-   176 "outputs": [],
-   177 "prompt_number": 45
-   178 },
-   179 {
-   180 "cell_type": "code",
-   181 "collapsed": false,
-   182 "input": [],
-   183 "language": "python",
-   184 "metadata": {},
-   185 "outputs": [],
-   186 "prompt_number": 45
111 }, 187 },
112 { 188 {
113 "cell_type": "code", 189 "cell_type": "code",
114 "collapsed": false, 190 "collapsed": false,
115 "input": [], 191 "input": [],