|
9 | 9 | },
|
10 | 10 | {
|
11 | 11 | "cell_type": "code",
|
12 |
| - "execution_count": 1, |
| 12 | + "execution_count": 6, |
13 | 13 | "metadata": {},
|
14 | 14 | "outputs": [],
|
15 | 15 | "source": [
|
|
23 | 23 | "cell_type": "markdown",
|
24 | 24 | "metadata": {},
|
25 | 25 | "source": [
|
26 |
| - "$Y =Asin(\\omega t + \\phi)$" |
| 26 | + "$ Y = Asin(\\omega t + \\phi )$" |
27 | 27 | ]
|
28 | 28 | },
|
29 | 29 | {
|
30 | 30 | "cell_type": "code",
|
31 |
| - "execution_count": 2, |
| 31 | + "execution_count": 7, |
32 | 32 | "metadata": {},
|
33 | 33 | "outputs": [
|
34 | 34 | {
|
|
38 | 38 | " 5.999e+01])"
|
39 | 39 | ]
|
40 | 40 | },
|
41 |
| - "execution_count": 2, |
| 41 | + "execution_count": 7, |
42 | 42 | "metadata": {},
|
43 | 43 | "output_type": "execute_result"
|
44 | 44 | }
|
|
51 | 51 | },
|
52 | 52 | {
|
53 | 53 | "cell_type": "code",
|
54 |
| - "execution_count": 3, |
| 54 | + "execution_count": 8, |
55 | 55 | "metadata": {},
|
56 | 56 | "outputs": [
|
57 | 57 | {
|
|
61 | 61 | " -0.28570267, -0.29527141])"
|
62 | 62 | ]
|
63 | 63 | },
|
64 |
| - "execution_count": 3, |
| 64 | + "execution_count": 8, |
65 | 65 | "metadata": {},
|
66 | 66 | "output_type": "execute_result"
|
67 | 67 | }
|
|
72 | 72 | },
|
73 | 73 | {
|
74 | 74 | "cell_type": "code",
|
75 |
| - "execution_count": 4, |
| 75 | + "execution_count": 9, |
76 | 76 | "metadata": {},
|
77 | 77 | "outputs": [
|
78 | 78 | {
|
|
82 | 82 | " 1.88401311e+02, 1.88432727e+02, 1.88464143e+02])"
|
83 | 83 | ]
|
84 | 84 | },
|
85 |
| - "execution_count": 4, |
| 85 | + "execution_count": 9, |
86 | 86 | "metadata": {},
|
87 | 87 | "output_type": "execute_result"
|
88 | 88 | }
|
|
101 | 101 | },
|
102 | 102 | {
|
103 | 103 | "cell_type": "code",
|
104 |
| - "execution_count": 5, |
| 104 | + "execution_count": 10, |
105 | 105 | "metadata": {},
|
106 | 106 | "outputs": [
|
107 | 107 | {
|
|
129 | 129 | "'''create oscillation: Y = Asin(wt)| w = 2.pi.f'''\n",
|
130 | 130 | "ys = amp*np.sin(ts*(2*np.pi*freq))\n",
|
131 | 131 | "\n",
|
132 |
| - "lb= \"amp: \"+str(amp) + \",freq:\"+str(freq) \n", |
| 132 | + "lb = \"amp: \" + str(amp) + \",freq:\" + str(freq) \n", |
133 | 133 | "plt.plot(ts,ys, label = lb)\n",
|
134 | 134 | " \n",
|
135 | 135 | "plt.xlabel(\"Time in seconds\") \n",
|
136 | 136 | "plt.ylabel(\"Displacement\")\n",
|
137 |
| - "plt.axis()\n", |
138 | 137 | "plt.legend()\n",
|
139 | 138 | "plt.show()"
|
140 | 139 | ]
|
|
148 | 147 | },
|
149 | 148 | {
|
150 | 149 | "cell_type": "code",
|
151 |
| - "execution_count": 9, |
| 150 | + "execution_count": 11, |
152 | 151 | "metadata": {},
|
153 | 152 | "outputs": [
|
154 | 153 | {
|
|
198 | 197 | },
|
199 | 198 | {
|
200 | 199 | "cell_type": "code",
|
201 |
| - "execution_count": 7, |
| 200 | + "execution_count": 15, |
202 | 201 | "metadata": {},
|
203 | 202 | "outputs": [
|
204 | 203 | {
|
|
231 | 230 | "'''create a plot'''\n",
|
232 | 231 | "plt.plot(ts,ys, label= \"Superposed oscillation\")\n",
|
233 | 232 | "plt.legend()\n",
|
234 |
| - "plt.show() " |
| 233 | + "plt.show()" |
235 | 234 | ]
|
236 | 235 | },
|
237 | 236 | {
|
|
248 | 247 | "-----------"
|
249 | 248 | ]
|
250 | 249 | },
|
251 |
| - { |
252 |
| - "cell_type": "code", |
253 |
| - "execution_count": null, |
254 |
| - "metadata": {}, |
255 |
| - "outputs": [], |
256 |
| - "source": [ |
257 |
| - "fourierTransform = np.fft.fft(ys)/len(ys) # Normalize amplitude\n", |
258 |
| - "fourierTransform = fourierTransform[range(int(len(ys)/2))] # Exclude sampling frequency\n", |
259 |
| - "\n", |
260 |
| - "tpCount = len(ys)\n", |
261 |
| - "values = np.arange(int(tpCount/2))\n", |
262 |
| - "timePeriod = tpCount/fs\n", |
263 |
| - "frequencies = values/timePeriod\n", |
264 |
| - "\n", |
265 |
| - " \n", |
266 |
| - "\n", |
267 |
| - "# Frequency domain representation\n", |
268 |
| - "plt.title('Fourier transform depicting the frequency components')\n", |
269 |
| - "plt.scatter(frequencies, abs(fourierTransform))\n", |
270 |
| - "plt.xlabel('Frequency')\n", |
271 |
| - "plt.ylabel('Amplitude')\n", |
272 |
| - "plt.xlim(0.1,0.4)\n", |
273 |
| - "plt.show()" |
274 |
| - ] |
275 |
| - }, |
276 | 250 | {
|
277 | 251 | "cell_type": "markdown",
|
278 | 252 | "metadata": {},
|
|
284 | 258 | },
|
285 | 259 | {
|
286 | 260 | "cell_type": "code",
|
287 |
| - "execution_count": 28, |
| 261 | + "execution_count": 14, |
288 | 262 | "metadata": {},
|
289 | 263 | "outputs": [],
|
290 | 264 | "source": [
|
|
0 commit comments