Show More
@@ -0,0 +1,110 | |||||
|
1 | { | |||
|
2 | "metadata": { | |||
|
3 | "name": "octavemagic_extension" | |||
|
4 | }, | |||
|
5 | "nbformat": 3, | |||
|
6 | "worksheets": [ | |||
|
7 | { | |||
|
8 | "cells": [ | |||
|
9 | { | |||
|
10 | "cell_type": "code", | |||
|
11 | "input": [ | |||
|
12 | "%load_ext octavemagic" | |||
|
13 | ], | |||
|
14 | "language": "python", | |||
|
15 | "outputs": [] | |||
|
16 | }, | |||
|
17 | { | |||
|
18 | "cell_type": "code", | |||
|
19 | "input": [ | |||
|
20 | "x = %octave [1 2; 3 4];", | |||
|
21 | "x" | |||
|
22 | ], | |||
|
23 | "language": "python", | |||
|
24 | "outputs": [] | |||
|
25 | }, | |||
|
26 | { | |||
|
27 | "cell_type": "code", | |||
|
28 | "input": [ | |||
|
29 | "a = [1, 2, 3]", | |||
|
30 | "", | |||
|
31 | "%octave_push a", | |||
|
32 | "%octave a = a * 2;", | |||
|
33 | "%octave_pull a", | |||
|
34 | "a" | |||
|
35 | ], | |||
|
36 | "language": "python", | |||
|
37 | "outputs": [] | |||
|
38 | }, | |||
|
39 | { | |||
|
40 | "cell_type": "code", | |||
|
41 | "input": [ | |||
|
42 | "%%octave -i x -o y", | |||
|
43 | "y = x + 3;" | |||
|
44 | ], | |||
|
45 | "language": "python", | |||
|
46 | "outputs": [] | |||
|
47 | }, | |||
|
48 | { | |||
|
49 | "cell_type": "code", | |||
|
50 | "input": [ | |||
|
51 | "y" | |||
|
52 | ], | |||
|
53 | "language": "python", | |||
|
54 | "outputs": [] | |||
|
55 | }, | |||
|
56 | { | |||
|
57 | "cell_type": "code", | |||
|
58 | "input": [ | |||
|
59 | "%%octave -f svg", | |||
|
60 | "", | |||
|
61 | "p = [12 -2.5 -8 -0.1 8];", | |||
|
62 | "x = 0:0.01:1;", | |||
|
63 | "", | |||
|
64 | "polyout(p, 'x')", | |||
|
65 | "plot(x, polyval(p, x));" | |||
|
66 | ], | |||
|
67 | "language": "python", | |||
|
68 | "outputs": [] | |||
|
69 | }, | |||
|
70 | { | |||
|
71 | "cell_type": "code", | |||
|
72 | "input": [ | |||
|
73 | "%%octave -s 500,500", | |||
|
74 | "", | |||
|
75 | "# butterworth filter, order 2, cutoff pi/2 radians", | |||
|
76 | "b = [0.292893218813452 0.585786437626905 0.292893218813452];", | |||
|
77 | "a = [1 0 0.171572875253810];", | |||
|
78 | "freqz(b, a, 32);" | |||
|
79 | ], | |||
|
80 | "language": "python", | |||
|
81 | "outputs": [] | |||
|
82 | }, | |||
|
83 | { | |||
|
84 | "cell_type": "code", | |||
|
85 | "input": [ | |||
|
86 | "%%octave -s 600,200 -f png", | |||
|
87 | "", | |||
|
88 | "subplot(121);", | |||
|
89 | "[x, y] = meshgrid(0:0.1:3);", | |||
|
90 | "r = sin(x - 0.5).^2 + cos(y - 0.5).^2;", | |||
|
91 | "surf(x, y, r);", | |||
|
92 | "", | |||
|
93 | "subplot(122);", | |||
|
94 | "sombrero()" | |||
|
95 | ], | |||
|
96 | "language": "python", | |||
|
97 | "outputs": [] | |||
|
98 | }, | |||
|
99 | { | |||
|
100 | "cell_type": "code", | |||
|
101 | "input": [ | |||
|
102 | "" | |||
|
103 | ], | |||
|
104 | "language": "python", | |||
|
105 | "outputs": [] | |||
|
106 | } | |||
|
107 | ] | |||
|
108 | } | |||
|
109 | ] | |||
|
110 | } No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now