##// END OF EJS Templates
Add octavemagic example notebook.
Add octavemagic example notebook.

File last commit:

r7451:7d297835
r7451:7d297835
Show More
octavemagic_extension.ipynb
109 lines | 1.9 KiB | text/plain | TextLexer
/ docs / examples / notebooks / octavemagic_extension.ipynb
In [ ]:
%load_ext octavemagic
In [ ]:
x = %octave [1 2; 3 4];
x
In [ ]:
a = [1, 2, 3]

%octave_push a
%octave a = a * 2;
%octave_pull a
a
In [ ]:
%%octave -i x -o y
y = x + 3;
In [ ]:
y
In [ ]:
%%octave -f svg

p = [12 -2.5 -8 -0.1 8];
x = 0:0.01:1;

polyout(p, 'x')
plot(x, polyval(p, x));
In [ ]:
%%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);
In [ ]:
%%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()
In [ ]: