Octave
octave:13> N=zeros(2,3)
N =
0 0 0 0 0 0
octave:14> O=ones(5,4)
O =
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
octave:15> L=4*O
L =
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
octave:16> z=eyes(7) error: `eyes' undefined near line 16 column 3 octave:16> z=eye(7) z =
Diagonal Matrix
1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1
octave:17> d=sin(pi) d = 1.2246e-016 octave:18> g=cos(pi/4) g = 0.70711 octave:19> e=tan(2*pi) e = -2.4492e-016 octave:20> h=exp(4) h = 54.598 octave:21> I=rand(3,7)
I =
Columns 1 through 6:
0.8174313 0.0089409 0.1669841 0.6926430 0.3864538 0.2141447 0.8675157 0.7137848 0.0676300 0.0506320 0.0659821 0.7160127 0.8161863 0.4717680 0.1844510 0.5498309 0.9980488 0.9502148
Column 7:
0.0129599 0.8375513 0.6811153
octave:22> I=rand(3)
I =
0.67427 0.59281 0.49306 0.80212 0.47290 0.20156 0.59643 0.56100 0.81269
octave:23> v=diag(I,o) error: `o' undefined near line 23 column 10 error: evaluating argument list element number 2 octave:23> v=diag(I,0) v =
0.67427 0.47290 0.81269
octave:24> I=rand(5)
I =
0.328164 0.207581 0.530363 0.924356 0.918297 0.027187 0.754559 0.910846 0.696483 0.089181 0.971881 0.270412 0.107789 0.182007 0.687056 0.883814 0.028743 0.356943 0.026453 0.928708 0.131107 0.123045 0.193609 0.645364 0.844673
octave:25> v=diag(I,-1) v =
0.027187 0.270412 0.356943 0.645364
octave:26> z=[-3:0.1:5] z =
Columns 1 through 6:
-3.0000e+000