n = 5; M = rand(n) + eye(n) M = 1.5818 0.9465 0.7207 0.9848 0.6884 0.0022 1.3132 0.4841 0.5300 0.9725 0.8500 0.2425 1.6876 0.9574 0.7598 0.3614 0.5394 0.4433 1.5807 0.9690 0.2977 0.5889 0.5899 0.1257 1.3920 n = 5; M = rand(n) + eye(n); diag(M) ans = 1.8587 1.0824 1.5745 1.0834 1.3581 n = 5; M = rand(n) + eye(n); 2*diag(M)' - sum(M) ans = 0.7023 -0.2362 -0.6123 -1.2509 -1.0733 n = 5; M = rand(n) + n*eye(n); 2*diag(M)' - sum(M) ans = 3.3811 3.3897 3.8040 2.7287 3.6412 n = 5; M = rand(n) + n*eye(n); 2*diag(M)' - sum(M) ans = 3.0935 3.4247 2.1540 3.7001 3.9607 n = 5; M = rand(n) + 2*eye(n); 2*diag(M)' - sum(M) ans = -0.5250 1.0633 -0.2443 0.8004 0.2971 n = 5; M = rand(n) + 2*eye(n); 2*diag(M)' - sum(M) ans = 0.2738 -0.2197 1.7929 0.3959 -0.1825 n = 5; M = rand(n) + 2*eye(n); 2*diag(M)' - sum(M) ans = 0.0363 0.1355 1.4057 -0.5340 0.6471 n = 5; M = rand(n) + 2*eye(n); 2*diag(M)' - sum(M) ans = 0.6165 1.4385 1.0514 0.9178 0.4118 n = 5; M = rand(n) + n*eye(n); (2*diag(M)' - sum(M))>0 ans = 1 1 1 1 1 n = 5; M = rand(n) + n*eye(n); sum((2*diag(M)' - sum(M))>0) ans = 5 n = 5; M = rand(n) + n*eye(n); sum((2*diag(M)' - sum(M))>0)-n ans = 0 n = 5; M = rand(n) + 3*eye(n); sum((2*diag(M)' - sum(M))>0)-n ans = 0 n = 5; M = rand(n) + 3*eye(n); sum((2*diag(M)' - sum(M))>0)-n ans = 0 n = 5; M = rand(n) + 3*eye(n); sum((2*diag(M)' - sum(M))>0)-n ans = 0 n = 5; M = rand(n) + 3*eye(n); sum((2*diag(M)' - sum(M))>0)-n ans = 0 n = 50; M = rand(n) + 3*eye(n); sum((2*diag(M)' - sum(M))>0)-n ans = -50 n = 50; M = rand(n) + 3*eye(n); sum((2*diag(M)' - sum(M))>0)-n ans = -50 n = 50; M = rand(n) + n*eye(n); sum((2*diag(M)' - sum(M))>0)-n ans = 0 n = 500; M = rand(n) + n*eye(n); sum((2*diag(M)' - sum(M))>0)-n ans = 0 n = 5; M = rand(n) + n*eye(n); eig(M) ans = 7.8997 5.1589 + 0.2642i 5.1589 - 0.2642i 4.7166 4.9022 n = 5; M = rand(n) + n*eye(n) M = 5.7501 0.3054 0.6577 0.2020 0.3360 0.9142 5.0190 0.1616 0.0430 0.1451 0.1715 0.9959 5.6305 0.2382 0.9627 0.1195 0.6645 0.8498 5.5482 0.5029 0.7207 0.6093 0.2608 0.2713 5.8548 n = 5; M = rand(n) + n*eye(n); M+M' ans = 10.0323 0.7012 1.0868 0.9029 1.1059 0.7012 11.9652 1.1143 0.6003 0.6158 1.0868 1.1143 11.5416 0.4322 0.9568 0.9029 0.6003 0.4322 11.4617 1.6762 1.1059 0.6158 0.9568 1.6762 11.6501 n = 5; M = rand(n) + n*eye(n); ltri(M) {??? Undefined function or method 'ltri' for input arguments of type 'double'. } n = 5; M = rand(n) + n*eye(n); tril(M) ans = 5.8020 0 0 0 0 0.7497 5.7531 0 0 0 0.5103 0.7454 5.9634 0 0 0.5505 0.6935 0.9553 5.1145 0 0.9374 0.1890 0.1202 0.4354 5.0018 n = 5; M = rand(n) + n*eye(n); tril(M)'+tril(M) ans = 11.1113 0.8644 0.3676 0.1273 0.2776 0.8644 10.9676 0.1377 0.1910 0.8143 0.3676 0.1377 10.8103 0.8879 0.2598 0.1273 0.1910 0.8879 11.8613 0.2450 0.2776 0.8143 0.2598 0.2450 10.6482 n = 5; M = rand(n) + n*eye(n); tril(M,-1) ans = 0 0 0 0 0 0.4242 0 0 0 0 0.4037 0.2654 0 0 0 0.9435 0.5203 0.4741 0 0 0.2256 0.7695 0.2438 0.7224 0 n = 5; M = rand(n) + n*eye(n); tril(M,-1) + tril(M)' ans = 5.3100 0.4662 0.0936 0.3730 0.0118 0.4662 5.0153 0.1598 0.1842 0.6334 0.0936 0.1598 5.3065 0.1415 0.5135 0.3730 0.1842 0.1415 5.4768 0.3298 0.0118 0.6334 0.5135 0.3298 5.9661 n = 5; M = rand(n) + n*eye(n); M = tril(M,-1) + tril(M)'; n = 5; M = rand(n) + n*eye(n); M = tril(M,-1) + tril(M)' M = 5.7256 0.8892 0.8501 0.3937 0.0698 0.8892 5.0201 0.0046 0.0538 0.0087 0.8501 0.0046 5.0267 0.5505 0.3199 0.3937 0.0538 0.5505 5.3591 0.1551 0.0698 0.0087 0.3199 0.1551 5.9651 n = 5; M = rand(n) + n*eye(n); M = tril(M,-1) + tril(M)'; eig(M) ans = 4.2210 4.3977 5.1949 5.6514 6.9958 n = 5; M = rand(n) + eye(n); M = tril(M,-1) + tril(M)'; eig(M) ans = 0.2416 1.0767 1.3569 1.5283 2.7769 n = 5; M = rand(n) + eye(n); M = tril(M,-1) + tril(M)'; eig(M) ans = 0.3764 0.6420 0.8599 2.2193 3.3580 n = 5; M = rand(n) + eye(n); M = tril(M,-1) + tril(M)'; eig(M) ans = 0.4107 0.7571 1.1927 1.7309 3.5503 n = 50; M = rand(n) + eye(n); M = tril(M,-1) + tril(M)'; eig(M) ans = -2.8358 -2.3400 -2.2199 -2.1090 -1.6517 -1.6399 -1.5270 -1.4464 -1.2558 -1.2315 -1.0863 -0.9787 -0.6895 -0.6134 -0.4908 -0.3792 -0.2523 -0.0877 0.0657 0.2850 0.3978 0.4474 0.6484 0.8624 0.9018 1.0873 1.1750 1.4816 1.5216 1.5895 1.7841 1.8961 1.9973 2.1118 2.1752 2.4494 2.5900 2.6265 2.7408 2.9358 3.0701 3.2208 3.5036 3.5880 3.8677 3.9721 4.2971 4.6028 4.8051 26.1652 n = 50; M = rand(n) + n*eye(n); M = tril(M,-1) + tril(M)'; eig(M) ans = 46.3461 46.5710 46.8868 47.0019 47.3047 47.5562 47.6357 47.7095 47.8401 47.9427 48.1708 48.3894 48.5382 48.5821 48.6760 48.8590 48.9522 49.1616 49.3174 49.3312 49.4593 49.7409 49.8645 50.0027 50.1053 50.3337 50.3819 50.5754 50.6722 50.7611 50.8486 51.1500 51.1968 51.2686 51.3824 51.5275 51.7598 51.8857 51.9871 52.1700 52.1827 52.4061 52.4878 52.7736 52.8843 53.1390 53.2190 53.6917 53.9447 75.2540 n = 50; M = rand(n) + n*eye(n); M = tril(M,-1) + tril(M)'; sum(eig(M)>0) ans = 50 n = 50; M = rand(n) + 3*eye(n); M = tril(M,-1) + tril(M)'; sum(eig(M)>0) ans = 47 n = 500; M = rand(n) + n*eye(n); M = tril(M,-1) + tril(M)'; sum(eig(M)>0) ans = 500 n = 2000; M = rand(n) + n*eye(n); M = tril(M,-1) + tril(M)'; sum(eig(M)>0) ans = 2000 n = 2000; M = rand(n) + (n-1)*eye(n); M = tril(M,-1) + tril(M)'; sum(eig(M)>0) ans = 2000 p=0:2*pi/99:2*pi p = Columns 1 through 8 0 0.0635 0.1269 0.1904 0.2539 0.3173 0.3808 0.4443 Columns 9 through 16 0.5077 0.5712 0.6347 0.6981 0.7616 0.8251 0.8885 0.9520 Columns 17 through 24 1.0155 1.0789 1.1424 1.2059 1.2693 1.3328 1.3963 1.4597 Columns 25 through 32 1.5232 1.5867 1.6501 1.7136 1.7771 1.8405 1.9040 1.9675 Columns 33 through 40 2.0309 2.0944 2.1579 2.2213 2.2848 2.3483 2.4117 2.4752 Columns 41 through 48 2.5387 2.6021 2.6656 2.7291 2.7925 2.8560 2.9195 2.9829 Columns 49 through 56 3.0464 3.1099 3.1733 3.2368 3.3003 3.3637 3.4272 3.4907 Columns 57 through 64 3.5541 3.6176 3.6811 3.7445 3.8080 3.8715 3.9349 3.9984 Columns 65 through 72 4.0619 4.1253 4.1888 4.2523 4.3157 4.3792 4.4427 4.5061 Columns 73 through 80 4.5696 4.6331 4.6965 4.7600 4.8235 4.8869 4.9504 5.0139 Columns 81 through 88 5.0773 5.1408 5.2043 5.2677 5.3312 5.3947 5.4581 5.5216 Columns 89 through 96 5.5851 5.6485 5.7120 5.7755 5.8389 5.9024 5.9659 6.0293 Columns 97 through 100 6.0928 6.1563 6.2197 6.2832 p p = Columns 1 through 8 0 0.0635 0.1269 0.1904 0.2539 0.3173 0.3808 0.4443 Columns 9 through 16 0.5077 0.5712 0.6347 0.6981 0.7616 0.8251 0.8885 0.9520 Columns 17 through 24 1.0155 1.0789 1.1424 1.2059 1.2693 1.3328 1.3963 1.4597 Columns 25 through 32 1.5232 1.5867 1.6501 1.7136 1.7771 1.8405 1.9040 1.9675 Columns 33 through 40 2.0309 2.0944 2.1579 2.2213 2.2848 2.3483 2.4117 2.4752 Columns 41 through 48 2.5387 2.6021 2.6656 2.7291 2.7925 2.8560 2.9195 2.9829 Columns 49 through 56 3.0464 3.1099 3.1733 3.2368 3.3003 3.3637 3.4272 3.4907 Columns 57 through 64 3.5541 3.6176 3.6811 3.7445 3.8080 3.8715 3.9349 3.9984 Columns 65 through 72 4.0619 4.1253 4.1888 4.2523 4.3157 4.3792 4.4427 4.5061 Columns 73 through 80 4.5696 4.6331 4.6965 4.7600 4.8235 4.8869 4.9504 5.0139 Columns 81 through 88 5.0773 5.1408 5.2043 5.2677 5.3312 5.3947 5.4581 5.5216 Columns 89 through 96 5.5851 5.6485 5.7120 5.7755 5.8389 5.9024 5.9659 6.0293 Columns 97 through 100 6.0928 6.1563 6.2197 6.2832 v = sin(p) + .1 * sin(40*p) + .05 * sin(45*p); plot(v) f = fft(v); f=fftshift(f); plot(abs(f)) kill = 15; f(1:kill) = 0; f(end-kill:end) = 0; plot(abs(f)) sig=ifftshift(f); sig=ifft(sig); sig sig = Columns 1 through 4 0.0336 + 0.0018i 0.0704 - 0.0037i 0.1109 + 0.0025i 0.1952 + 0.0009i Columns 5 through 8 0.2567 - 0.0035i 0.3034 + 0.0030i 0.3754 + 0.0001i 0.4328 - 0.0031i Columns 9 through 12 0.4806 + 0.0034i 0.5437 - 0.0008i 0.5942 - 0.0025i 0.6391 + 0.0035i Columns 13 through 16 0.6927 - 0.0015i 0.7348 - 0.0017i 0.7739 + 0.0034i 0.8167 - 0.0021i Columns 17 through 20 0.8493 - 0.0009i 0.8803 + 0.0031i 0.9111 - 0.0025i 0.9334 - 0.0002i Columns 21 through 24 0.9546 + 0.0026i 0.9727 - 0.0027i 0.9840 + 0.0005i 0.9942 + 0.0020i Columns 25 through 28 0.9990 - 0.0027i 0.9993 + 0.0011i 0.9975 + 0.0013i 0.9894 - 0.0025i Columns 29 through 32 0.9787 + 0.0015i 0.9646 + 0.0007i 0.9441 - 0.0021i 0.9227 + 0.0017i Columns 33 through 36 0.8966 + 0.0001i 0.8648 - 0.0016i 0.8334 + 0.0017i 0.7961 - 0.0004i Columns 37 through 40 0.7544 - 0.0011i 0.7140 + 0.0015i 0.6667 - 0.0007i 0.6169 - 0.0005i Columns 41 through 44 0.5687 + 0.0012i 0.5131 - 0.0008i 0.4572 - 0.0001i 0.4027 + 0.0007i Columns 45 through 48 0.3410 - 0.0008i 0.2810 + 0.0003i 0.2222 + 0.0003i 0.1566 - 0.0005i Columns 49 through 52 0.0948 + 0.0004i 0.0334 - 0.0002i -0.0334 - 0.0002i -0.0948 + 0.0004i Columns 53 through 56 -0.1566 - 0.0005i -0.2222 + 0.0003i -0.2810 + 0.0003i -0.3410 - 0.0008i Columns 57 through 60 -0.4027 + 0.0007i -0.4572 - 0.0001i -0.5131 - 0.0008i -0.5687 + 0.0012i Columns 61 through 64 -0.6169 - 0.0005i -0.6667 - 0.0007i -0.7140 + 0.0015i -0.7544 - 0.0011i Columns 65 through 68 -0.7961 - 0.0004i -0.8334 + 0.0017i -0.8648 - 0.0016i -0.8966 + 0.0001i Columns 69 through 72 -0.9227 + 0.0017i -0.9441 - 0.0021i -0.9646 + 0.0007i -0.9787 + 0.0015i Columns 73 through 76 -0.9894 - 0.0025i -0.9975 + 0.0013i -0.9993 + 0.0011i -0.9990 - 0.0027i Columns 77 through 80 -0.9942 + 0.0020i -0.9840 + 0.0005i -0.9727 - 0.0027i -0.9546 + 0.0026i Columns 81 through 84 -0.9334 - 0.0002i -0.9111 - 0.0025i -0.8803 + 0.0031i -0.8493 - 0.0009i Columns 85 through 88 -0.8167 - 0.0021i -0.7739 + 0.0034i -0.7348 - 0.0017i -0.6927 - 0.0015i Columns 89 through 92 -0.6391 + 0.0035i -0.5942 - 0.0025i -0.5437 - 0.0008i -0.4806 + 0.0034i Columns 93 through 96 -0.4328 - 0.0031i -0.3754 + 0.0001i -0.3034 + 0.0030i -0.2567 - 0.0035i Columns 97 through 100 -0.1952 + 0.0009i -0.1109 + 0.0025i -0.0704 - 0.0037i -0.0336 + 0.0018i plot(real(sig)) subplot(1,2,1) plot([0:2*pi],v) {??? Error using ==> plot Vectors must be the same lengths. } plot([0:2*pi/99:2*pi],v) axis([0 2*pi -1 1]) subplot(1,2,2) plot([0:2*pi/99:2*pi],sig) {Warning: Imaginary parts of complex X and/or Y arguments ignored} plot([0:2*pi/99:2*pi],real(sig)) axis([0 2*pi -1 1]) clc var {??? Input argument "x" is undefined. Error in ==> var at 55 if isinteger(x) } var = 3 var = 3 pi ans = 3.1416 format long pi ans = 3.141592653589793 pi = 3 pi = 3 clear('pi') pi ans = 3.141592653589793 pi ans = 3.141592653589793 i ans = 0 + 1.000000000000000i sqrt(-1) ans = 0 + 1.000000000000000i i*i ans = -1 for i=1:5, i*i, end ans = 1 ans = 4 ans = 9 ans = 16 ans = 25 i i = 5 j ans = 0 + 1.000000000000000i clear('i') i ans = 0 + 1.000000000000000i , ; ; ; , 3, 4 ans = 3 ans = 4 3, 4; ans = 3 3; 4; a = [ 1, 2, 3 ] a = 1 2 3 a = [ 1; 2; 3 ] a = 1 2 3 a = [ 1, 2; 3, 4 ] a = 1 2 3 4 a = [ 1, 2, 3; 3, 4 ] {??? Error using ==> vertcat CAT arguments dimensions are not consistent. } a = [ 1, 2, 3; 3, 4 6 ] a = 1 2 3 3 4 6 a = [ 1 2 3; 3 4 6 ] a = 1 2 3 3 4 6 a = [ 1 2; 3 3; 4 6 ] a = 1 2 3 3 4 6 who(a) {??? Error using ==> who Argument must contain a string. } who('a') Your variables are: a whos('a') Name Size Bytes Class Attributes a 3x2 48 double A = [ 1 2; 3 3; 4 6 ] A = 1 2 3 3 4 6 A >= 4 ans = 0 0 0 0 1 1 B = (A >= 4) B = 0 0 0 0 1 1 diary diary on B = (A >= 4) B = 0 0 0 0 1 1 whos(B) {??? Error using ==> whos Argument must contain a string. } whos('B') Name Size Bytes Class Attributes B 3x2 6 logical B(1,2) = 2 B = 0 1 0 0 1 1 whos('B') Name Size Bytes Class Attributes B 3x2 6 logical B B = 0 1 0 0 1 1 eye(4) ans = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ones(3) ans = 1 1 1 1 1 1 1 1 1 ones(3,1) ans = 1 1 1 ones(1,3) ans = 1 1 1 ones(3,3) ans = 1 1 1 1 1 1 1 1 1 ones(3,5) ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 eye(10) ans = 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 ones(2,3,4) ans(:,:,1) = 1 1 1 1 1 1 ans(:,:,2) = 1 1 1 1 1 1 ans(:,:,3) = 1 1 1 1 1 1 ans(:,:,4) = 1 1 1 1 1 1 zeros(2,3,4) ans(:,:,1) = 0 0 0 0 0 0 ans(:,:,2) = 0 0 0 0 0 0 ans(:,:,3) = 0 0 0 0 0 0 ans(:,:,4) = 0 0 0 0 0 0 rand(2,3,4) ans(:,:,1) = 0.783292203092418 0.586842661781516 0.691967087791957 0.488181809237104 0.516822573945681 0.136949936063636 ans(:,:,2) = 0.041048270809983 0.899323465402257 0.539383202644718 0.821852626319204 0.039042205672372 0.897502934754357 ans(:,:,3) = 0.003338297440856 0.637410219128286 0.731300637641241 0.303175076826571 0.048033325122765 0.506575180032002 ans(:,:,4) = 0.675074168412406 0.931078523547922 0.949400853160194 0.558981961950492 0.154516896627420 0.939229068054814 randn(2,3,4) ans(:,:,1) = -1.489321221754214 -0.026884201107268 0.546457045246096 0.564655812046377 -0.177152447997502 -1.450497242828195 ans(:,:,2) = 0.219465902198722 0.515117389883390 0.909454077547333 0.089850485053264 -0.612147940668830 -0.387670071845707 ans(:,:,3) = 0.965839984505778 -1.862800868197940 2.180021166173086 -0.315211174811857 0.647857039599469 -0.180416943615544 ans(:,:,4) = -0.940711719964658 -0.034232503542558 0.093176595358740 0.432821089655967 0.823858964257223 1.368084575777622 clc ls H.m my_chol.m trsm.m Yurii.m p_dj.m yulia.m createfigure.m rand_16_1024.mat yulia.m~ diary_part1 rand_3.mat distr.m strassen.m cd /Users/pauldj/Documents/MATLAB pwd ans = /Users/pauldj/Documents/MATLAB clc linspace( 1, 3, 100 ) ans = Columns 1 through 4 1.000000000000000 1.020202020202020 1.040404040404040 1.060606060606061 Columns 5 through 8 1.080808080808081 1.101010101010101 1.121212121212121 1.141414141414141 Columns 9 through 12 1.161616161616162 1.181818181818182 1.202020202020202 1.222222222222222 Columns 13 through 16 1.242424242424242 1.262626262626263 1.282828282828283 1.303030303030303 Columns 17 through 20 1.323232323232323 1.343434343434343 1.363636363636364 1.383838383838384 Columns 21 through 24 1.404040404040404 1.424242424242424 1.444444444444444 1.464646464646465 Columns 25 through 28 1.484848484848485 1.505050505050505 1.525252525252525 1.545454545454545 Columns 29 through 32 1.565656565656566 1.585858585858586 1.606060606060606 1.626262626262626 Columns 33 through 36 1.646464646464647 1.666666666666667 1.686868686868687 1.707070707070707 Columns 37 through 40 1.727272727272727 1.747474747474747 1.767676767676768 1.787878787878788 Columns 41 through 44 1.808080808080808 1.828282828282828 1.848484848484849 1.868686868686869 Columns 45 through 48 1.888888888888889 1.909090909090909 1.929292929292929 1.949494949494949 Columns 49 through 52 1.969696969696970 1.989898989898990 2.010101010101010 2.030303030303030 Columns 53 through 56 2.050505050505051 2.070707070707071 2.090909090909091 2.111111111111111 Columns 57 through 60 2.131313131313131 2.151515151515151 2.171717171717172 2.191919191919192 Columns 61 through 64 2.212121212121212 2.232323232323232 2.252525252525253 2.272727272727272 Columns 65 through 68 2.292929292929293 2.313131313131313 2.333333333333333 2.353535353535354 Columns 69 through 72 2.373737373737374 2.393939393939394 2.414141414141414 2.434343434343434 Columns 73 through 76 2.454545454545455 2.474747474747475 2.494949494949495 2.515151515151515 Columns 77 through 80 2.535353535353535 2.555555555555555 2.575757575757576 2.595959595959596 Columns 81 through 84 2.616161616161616 2.636363636363637 2.656565656565657 2.676767676767676 Columns 85 through 88 2.696969696969697 2.717171717171717 2.737373737373737 2.757575757575758 Columns 89 through 92 2.777777777777778 2.797979797979798 2.818181818181818 2.838383838383838 Columns 93 through 96 2.858585858585859 2.878787878787879 2.898989898989899 2.919191919191919 Columns 97 through 100 2.939393939393939 2.959595959595959 2.979797979797980 3.000000000000000 v = linspace( 1, 3, 10 ) v = Columns 1 through 4 1.000000000000000 1.222222222222222 1.444444444444444 1.666666666666667 Columns 5 through 8 1.888888888888889 2.111111111111111 2.333333333333333 2.555555555555555 Columns 9 through 10 2.777777777777778 3.000000000000000 v = linspace( 1, 3, 10 ); v = linspace( 1, 3, 10 ) v = Columns 1 through 4 1.000000000000000 1.222222222222222 1.444444444444444 1.666666666666667 Columns 5 through 8 1.888888888888889 2.111111111111111 2.333333333333333 2.555555555555555 Columns 9 through 10 2.777777777777778 3.000000000000000 format short v = linspace( 1, 3, 10 ) v = Columns 1 through 8 1.0000 1.2222 1.4444 1.6667 1.8889 2.1111 2.3333 2.5556 Columns 9 through 10 2.7778 3.0000 v' ans = 1.0000 1.2222 1.4444 1.6667 1.8889 2.1111 2.3333 2.5556 2.7778 3.0000 v'' ans = Columns 1 through 8 1.0000 1.2222 1.4444 1.6667 1.8889 2.1111 2.3333 2.5556 Columns 9 through 10 2.7778 3.0000 A = [1 1; 2 2]; B = [3 3; 4 4]; C = [1 2 3; 1 2 3]; D = [ A B; C ] {??? Error using ==> vertcat CAT arguments dimensions are not consistent. } D = [ A B A; C C] D = 1 1 3 3 1 1 2 2 4 4 2 2 1 2 3 1 2 3 1 2 3 1 2 3 D = [ A B [ 10; 11 ] ] D = 1 1 3 3 10 2 2 4 4 11 D = [ A B [ 10; 11 ]; C A ] D = 1 1 3 3 10 2 2 4 4 11 1 2 3 1 1 1 2 3 2 2 D(1,1) ans = 1 D(1,3) ans = 3 D(1,5) ans = 10 D(3,5) ans = 1 D(2) ans = 2 D D = 1 1 3 3 10 2 2 4 4 11 1 2 3 1 1 1 2 3 2 2 D(2) ans = 2 1:4 ans = 1 2 3 4 4:5 ans = 4 5 D(1:4, 2) ans = 1 2 2 2 D(2:4, 2) ans = 2 2 2 D D = 1 1 3 3 10 2 2 4 4 11 1 2 3 1 1 1 2 3 2 2 D(1:4, 3) ans = 3 4 3 3 D(:, 3) ans = 3 4 3 3 D(3, :) ans = 1 2 3 1 1 D(:) ans = 1 2 1 1 1 2 2 2 3 4 3 3 3 4 1 2 10 11 1 2 D D = 1 1 3 3 10 2 2 4 4 11 1 2 3 1 1 1 2 3 2 2 5:-2:1 ans = 5 3 1 D D = 1 1 3 3 10 2 2 4 4 11 1 2 3 1 1 1 2 3 2 2 D( 3:4, 5:-3:1 ) ans = 1 2 2 2 5:-3:1 ans = 5 2 D( end:-1:1, end:-1:1 ) ans = 2 2 3 2 1 1 1 3 2 1 11 4 4 2 2 10 3 3 1 1 D( 2:3, 2:3 ) ans = 2 4 2 3 D D = 1 1 3 3 10 2 2 4 4 11 1 2 3 1 1 1 2 3 2 2 D( 1, 5 ) = 20 D = 1 1 3 3 20 2 2 4 4 11 1 2 3 1 1 1 2 3 2 2 D( 4, 5 ) = -2 D = 1 1 3 3 20 2 2 4 4 11 1 2 3 1 1 1 2 3 2 -2 D( 5, 5 ) = 1 D = 1 1 3 3 20 2 2 4 4 11 1 2 3 1 1 1 2 3 2 -2 0 0 0 0 1 D( 7, 6 ) = 1 D = 1 1 3 3 20 0 2 2 4 4 11 0 1 2 3 1 1 0 1 2 3 2 -2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 D( 1:2, : ) ans = 1 1 3 3 20 0 2 2 4 4 11 0 size( D( 1:2, : ) ) ans = 2 6 2:1 ans = Empty matrix: 1-by-0 D( 2:1, : ) ans = Empty matrix: 0-by-6 top = D( 2:1, : ) top = Empty matrix: 0-by-6 bot = D( 1, : ) bot = 1 1 3 3 20 0 [ top; bot ] ans = 1 1 3 3 20 0 top top = Empty matrix: 0-by-6 top * rand(6) ans = Empty matrix: 0-by-6 top * rand(6,5) ans = Empty matrix: 0-by-5 D( :, 0 ) {??? Attempted to access D(:,0); index must be a positive integer or logical. } D( :, [] ) ans = Empty matrix: 7-by-0 D( :, [] ) * top ans = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D( 2:1, 2:1 ) ans = [] diary