rand
randn
whos
A=[1 2 3; 5 6 7]
x=[0:8 7:-1:2 3:6 5 4 5 5 5];
plot(x) plot(x,'*')
[X,Y] = meshgrid(x,y); Z=X.^2+Y.^2 subplot(1,2,2) surf(X,Y,Z) sinus(x)
3
9.6397238
1i
-99
1.60210e-20
-3.14159j
0.0001
6.02252e23
3e5i
pi
i
j (same as i)
Inf
NaN
create file containing these lines
A = [ ... 1 0 0 0 0 1 0 0 0 0 1 0 ];
Store the file under magik.m, afterwards you can load this file with
magik
X = A; X(:,2) = []
X(2:2:10 = []
e = eig(A)
poly(A)
n = (0:9)';
pows = [n n.^2 2.^n] pows = 0 0 1 1 1 2 2 4 4 3 9 8 4 16 16 5 25 32 6 36 64 7 49 128 8 64 256 9 81 512
Useful is also the building of value tables like logarithm.
format short g x = (0.1:0.5:10)'; logs = [x log10(x)]
logs =
0.1 -1 0.6 -0.22185 1.1 0.041393 1.6 0.20412 2.1 0.32222 2.6 0.41497 3.1 0.49136 3.6 0.5563 4.1 0.61278 4.6 0.66276 5.1 0.70757 5.6 0.74819 6.1 0.78533 6.6 0.81954 7.1 0.85126 7.6 0.88081 8.1 0.90849 8.6 0.9345 9.1 0.95904 9.6 0.98227 EDU>> x = [4/3 1.2345e-6] x = 1.3333 1.2345e-06 EDU>> format short EDU>> x x = 1.3333 0.0000 EDU>> format short e EDU>> x x = 1.3333e+00 1.2345e-06 EDU>> format short g;x x = 1.3333 1.2345e-06 EDU>> format long;x x = 1.33333333333333 0.00000123450000 EDU>> format long e;x x = 1.333333333333333e+00 1.234500000000000e-06 EDU>> format long g;x x = 1.33333333333333 1.2345e-06 EDU>> format bank;x x = 1.33 0.00 EDU>> format rat;x x = 4/3 1/810045 EDU>> format hex;x x = 3ff5555555555555 3eb4b6231abfd271
A=[4 2 14 4 10 ; 2 10 19 14 11; 14 19 74 51 52; 4 14 51 150 75 ; 10 11 52 75 56] chol(A)
This can be quickly solved by:
R=chol(A); x = R\(R'\[136;227;790;811;656])
y = R'\[136;227;790;811;656 x = R\y