Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download

Jupyter notebook support/2016-02-23-matlab.ipynb

Views: 68
Kernel: Octave (MATLAB-like)
a = [1 2 3 4 6 4 3 4 5]
a = 1 2 3 4 6 4 3 4 5
b = a + 2
b = 3 4 5 6 8 6 5 6 7
plot(b) grid on
Image in a Jupyter notebook
MIME type unknown not supported
bar(b) xlabel('Sample #') ylabel('Pounds')
Image in a Jupyter notebook
MIME type unknown not supported
plot(b,'*') axis([0 10 0 10])
Image in a Jupyter notebook
MIME type unknown not supported
A = [1 2 0; 2 5 -1; 4 10 -1]
A = 1 2 0 2 5 -1 4 10 -1
B = A'
B = 1 2 4 2 5 10 0 -1 -1
C = A * B
C = 5 12 24 12 30 59 24 59 117
C = A .* B
C = 1 4 0 4 25 -10 0 -10 1
b = [1;3;5] x = A\b
b = 1 3 5 x = 1 -0 -1
r = A*x - b
r = 0 0 0
eig(A)
ans = 3.73205 0.26795 1.00000
svd(A)
ans = 12.31706 0.51490 0.15768
p = round(poly(A))
p = 1 -5 5 -1
roots(p)
ans = 3.73205 1.00000 0.26795
q = conv(p,p)
q = 1 -10 35 -52 35 -10 1
r = conv(p,q) plot(r);
Image in a Jupyter notebook
r = 1 -15 90 -278 480 -480 278 -90 15 -1
whos
Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== A 3x3 72 double B 3x3 72 double C 3x3 72 double _fig 1x1 8 double _figHandles 1x1 8 double _filename 1x27 27 char _handle 1x1 8 double a 1x9 72 double ans 3x1 24 double b 3x1 24 double p 1x4 32 double q 1x7 56 double r 1x10 80 double theta 1x6284 24 double x 3x1 24 double Total is 6380 elements using 603 bytes
A
A = 1 2 0 2 5 -1 4 10 -1
sqrt(-1)
ans = 0 + 1i