diff --git a/docs/examples/notebooks/octavemagic_extension.ipynb b/docs/examples/notebooks/octavemagic_extension.ipynb new file mode 100644 index 0000000..8cb1266 --- /dev/null +++ b/docs/examples/notebooks/octavemagic_extension.ipynb @@ -0,0 +1,110 @@ +{ + "metadata": { + "name": "octavemagic_extension" + }, + "nbformat": 3, + "worksheets": [ + { + "cells": [ + { + "cell_type": "code", + "input": [ + "%load_ext octavemagic" + ], + "language": "python", + "outputs": [] + }, + { + "cell_type": "code", + "input": [ + "x = %octave [1 2; 3 4];", + "x" + ], + "language": "python", + "outputs": [] + }, + { + "cell_type": "code", + "input": [ + "a = [1, 2, 3]", + "", + "%octave_push a", + "%octave a = a * 2;", + "%octave_pull a", + "a" + ], + "language": "python", + "outputs": [] + }, + { + "cell_type": "code", + "input": [ + "%%octave -i x -o y", + "y = x + 3;" + ], + "language": "python", + "outputs": [] + }, + { + "cell_type": "code", + "input": [ + "y" + ], + "language": "python", + "outputs": [] + }, + { + "cell_type": "code", + "input": [ + "%%octave -f svg", + "", + "p = [12 -2.5 -8 -0.1 8];", + "x = 0:0.01:1;", + "", + "polyout(p, 'x')", + "plot(x, polyval(p, x));" + ], + "language": "python", + "outputs": [] + }, + { + "cell_type": "code", + "input": [ + "%%octave -s 500,500", + "", + "# butterworth filter, order 2, cutoff pi/2 radians", + "b = [0.292893218813452 0.585786437626905 0.292893218813452];", + "a = [1 0 0.171572875253810];", + "freqz(b, a, 32);" + ], + "language": "python", + "outputs": [] + }, + { + "cell_type": "code", + "input": [ + "%%octave -s 600,200 -f png", + "", + "subplot(121);", + "[x, y] = meshgrid(0:0.1:3);", + "r = sin(x - 0.5).^2 + cos(y - 0.5).^2;", + "surf(x, y, r);", + "", + "subplot(122);", + "sombrero()" + ], + "language": "python", + "outputs": [] + }, + { + "cell_type": "code", + "input": [ + "" + ], + "language": "python", + "outputs": [] + } + ] + } + ] +} \ No newline at end of file