Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: sagemathinc/cocalc-example-files
Path: blob/master/octave/octave-ipython.ipynb
Views: 918
Kernel: Unknown Kernel
%load_ext octavemagic
x = %octave [1 2; 3 4]; x
array([[ 1., 2.], [ 3., 4.]])
a = [1, 2, 3] %octave_push a %octave a = a * 2; %octave_pull a a
array([[2, 4, 6]])
%%octave -i x -o y y = x + 3;
y
array([[ 4., 5.], [ 6., 7.]])
%%octave -f svg p = [12 -2.5 -8 -0.1 8]; x = 0:0.01:1; polyout(p, 'x') plot(x, polyval(p, x));
%%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);
%%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()