3+4 ans = 7 diary while while | {Error: Expression or statement is incomplete or incorrect. } for i = [1 2 5 pi -3], i^2, end ans = 1 ans = 4 ans = 25 ans = 9.8696 ans = 9 if cond_expression < <=, ~= < <=, ~= | {Error: Unexpected MATLAB operator. } if, if( cond ) else ... if, if( cond ) else ... | {Error: Expression or statement is incomplete or incorrect. } if elseif end if elseif end | {Error: Illegal use of reserved keyword "elseif". } doc switch n=10; xs = 9*rand(1,n)+1; ys = .5*xs.^2 + 2*xs + randn(n); {Error using + Matrix dimensions must agree. } ys = .5*xs.^2 + 2*xs + randn(1,n); plot(xs,ys,*) plot(xs,ys,*) | {Error: Unexpected MATLAB operator. } plot(xs,ys,'*') n=50; xs = 9*rand(1,n)+1; ys = .5*xs.^2 + 2*xs + randn(1,n); plot(xs,ys,'*') M = [ xs', ones(n,1) ]; whos('M') Name Size Bytes Class Attributes M 50x2 800 double coeff = M \ obs {Undefined function or variable 'obs'. } coeff = M \ ys {Error using \ Matrix dimensions must agree. } coeff = M \ ys' coeff = 7.4815 -11.2324 mod = xs * coeff(1) + coeff(2); hold on plot( xs, mod ) size(M) ans = 50 2 M = [ xs'.^2 M ] M = 93.2592 9.6571 1.0000 1.0852 1.0417 1.0000 63.5878 7.9742 1.0000 69.8182 8.3557 1.0000 77.7616 8.8183 1.0000 3.0973 1.7599 1.0000 21.1420 4.5980 1.0000 11.1478 3.3388 1.0000 67.2501 8.2006 1.0000 23.8410 4.8827 1.0000 84.5633 9.1958 1.0000 6.9518 2.6366 1.0000 11.3854 3.3742 1.0000 5.3354 2.3099 1.0000 4.9489 2.2246 1.0000 77.8564 8.8236 1.0000 38.6553 6.2173 1.0000 35.3875 5.9487 1.0000 5.3111 2.3046 1.0000 75.2952 8.6773 1.0000 43.5402 6.5985 1.0000 17.2937 4.1586 1.0000 31.5759 5.6192 1.0000 21.3100 4.6163 1.0000 2.8348 1.6837 1.0000 9.9808 3.1592 1.0000 4.4516 2.1099 1.0000 7.0499 2.6552 1.0000 9.9829 3.1596 1.0000 22.6139 4.7554 1.0000 2.0935 1.4469 1.0000 83.2555 9.1244 1.0000 90.3086 9.5031 1.0000 29.3523 5.4178 1.0000 29.1954 5.4033 1.0000 16.3174 4.0395 1.0000 82.8188 9.1005 1.0000 18.6902 4.3232 1.0000 4.0033 2.0008 1.0000 64.3568 8.0223 1.0000 20.3189 4.5076 1.0000 10.0820 3.1752 1.0000 21.4852 4.6352 1.0000 3.4898 1.8681 1.0000 4.7863 2.1878 1.0000 89.8411 9.4785 1.0000 92.2601 9.6052 1.0000 38.1538 6.1769 1.0000 2.3655 1.5380 1.0000 9.6909 3.1130 1.0000 M(:,1) = [] M = 9.6571 1.0000 1.0417 1.0000 7.9742 1.0000 8.3557 1.0000 8.8183 1.0000 1.7599 1.0000 4.5980 1.0000 3.3388 1.0000 8.2006 1.0000 4.8827 1.0000 9.1958 1.0000 2.6366 1.0000 3.3742 1.0000 2.3099 1.0000 2.2246 1.0000 8.8236 1.0000 6.2173 1.0000 5.9487 1.0000 2.3046 1.0000 8.6773 1.0000 6.5985 1.0000 4.1586 1.0000 5.6192 1.0000 4.6163 1.0000 1.6837 1.0000 3.1592 1.0000 2.1099 1.0000 2.6552 1.0000 3.1596 1.0000 4.7554 1.0000 1.4469 1.0000 9.1244 1.0000 9.5031 1.0000 5.4178 1.0000 5.4033 1.0000 4.0395 1.0000 9.1005 1.0000 4.3232 1.0000 2.0008 1.0000 8.0223 1.0000 4.5076 1.0000 3.1752 1.0000 4.6352 1.0000 1.8681 1.0000 2.1878 1.0000 9.4785 1.0000 9.6052 1.0000 6.1769 1.0000 1.5380 1.0000 3.1130 1.0000 M = [ xs'.*M , ones(n,1) ] {Error using .* Matrix dimensions must agree. } xs' .* M {Error using .* Matrix dimensions must agree. } xs' .* M(:,1) ans = 93.2592 1.0852 63.5878 69.8182 77.7616 3.0973 21.1420 11.1478 67.2501 23.8410 84.5633 6.9518 11.3854 5.3354 4.9489 77.8564 38.6553 35.3875 5.3111 75.2952 43.5402 17.2937 31.5759 21.3100 2.8348 9.9808 4.4516 7.0499 9.9829 22.6139 2.0935 83.2555 90.3086 29.3523 29.1954 16.3174 82.8188 18.6902 4.0033 64.3568 20.3189 10.0820 21.4852 3.4898 4.7863 89.8411 92.2601 38.1538 2.3655 9.6909 M = [ xs'.^2 M ] M = 93.2592 9.6571 1.0000 1.0852 1.0417 1.0000 63.5878 7.9742 1.0000 69.8182 8.3557 1.0000 77.7616 8.8183 1.0000 3.0973 1.7599 1.0000 21.1420 4.5980 1.0000 11.1478 3.3388 1.0000 67.2501 8.2006 1.0000 23.8410 4.8827 1.0000 84.5633 9.1958 1.0000 6.9518 2.6366 1.0000 11.3854 3.3742 1.0000 5.3354 2.3099 1.0000 4.9489 2.2246 1.0000 77.8564 8.8236 1.0000 38.6553 6.2173 1.0000 35.3875 5.9487 1.0000 5.3111 2.3046 1.0000 75.2952 8.6773 1.0000 43.5402 6.5985 1.0000 17.2937 4.1586 1.0000 31.5759 5.6192 1.0000 21.3100 4.6163 1.0000 2.8348 1.6837 1.0000 9.9808 3.1592 1.0000 4.4516 2.1099 1.0000 7.0499 2.6552 1.0000 9.9829 3.1596 1.0000 22.6139 4.7554 1.0000 2.0935 1.4469 1.0000 83.2555 9.1244 1.0000 90.3086 9.5031 1.0000 29.3523 5.4178 1.0000 29.1954 5.4033 1.0000 16.3174 4.0395 1.0000 82.8188 9.1005 1.0000 18.6902 4.3232 1.0000 4.0033 2.0008 1.0000 64.3568 8.0223 1.0000 20.3189 4.5076 1.0000 10.0820 3.1752 1.0000 21.4852 4.6352 1.0000 3.4898 1.8681 1.0000 4.7863 2.1878 1.0000 89.8411 9.4785 1.0000 92.2601 9.6052 1.0000 38.1538 6.1769 1.0000 2.3655 1.5380 1.0000 9.6909 3.1130 1.0000 coeff = M \ ys' coeff = 0.4958 1.9755 0.2126 mod = xs.^2 * coeff(1) + xs * coeff(2) + coeff(3); plot( xs, mod ) close all plot( xs, ys, '-', xs, mod, '*' ) sort {Error using sort Not enough input arguments. } plot( xs, mod, '*' ) plot( xs, mod, '*', xs, ys, '+' ) xs xs = Columns 1 through 7 9.6571 1.0417 7.9742 8.3557 8.8183 1.7599 4.5980 Columns 8 through 14 3.3388 8.2006 4.8827 9.1958 2.6366 3.3742 2.3099 Columns 15 through 21 2.2246 8.8236 6.2173 5.9487 2.3046 8.6773 6.5985 Columns 22 through 28 4.1586 5.6192 4.6163 1.6837 3.1592 2.1099 2.6552 Columns 29 through 35 3.1596 4.7554 1.4469 9.1244 9.5031 5.4178 5.4033 Columns 36 through 42 4.0395 9.1005 4.3232 2.0008 8.0223 4.5076 3.1752 Columns 43 through 49 4.6352 1.8681 2.1878 9.4785 9.6052 6.1769 1.5380 Column 50 3.1130 close plot( xs, mod, '*-' ) help norm norm Matrix or vector norm. norm(X,2) returns the 2-norm of X. norm(X) is the same as norm(X,2). norm(X,1) returns the 1-norm of X. norm(X,Inf) returns the infinity norm of X. norm(X,'fro') returns the Frobenius norm of X. In addition, for vectors... norm(V,P) returns the p-norm of V defined as SUM(ABS(V).^P)^(1/P). norm(V,Inf) returns the largest element of ABS(V). norm(V,-Inf) returns the smallest element of ABS(V). By convention, NaN is returned if X or V contains NaNs. See also cond, rcond, condest, normest, hypot. Reference page in Help browser doc norm close all pts = linspace(0, 2*pi, 100); signal = sin(pts) + sin(1.5*pts) + sin(2*pts); 1 ans = 1 subplot(1,3,1); plot( pts, signal ) subplot(1,2,1); plot( pts, signal ) axes([0,2*pi,-1.5,3]) {Error using axes Handles of type Root cannot be made the current Axes. } axis([0,2*pi,-1.5,3]) signal = sin(pts) + sin(1.5*pts) + sin(2*pts) + sin(45*pts)*.05; subplot(1,2,2); plot( pts, signal ) axis([0,2*pi,-1.5,3]) freq = fft(signal); freq2 = fftshift(freq); figure subplot(1,2,1); plot(abs(freq2)) size(freq2) ans = 1 100 width=10; freq2= freq2= | {Error: Expression or statement is incomplete or incorrect. } freq2(1:width)=0; freq2(end-width:end)=0; subplot(1,2,2); plot(abs(freq2)) ifft(ifftshift(freq2)) ans = Columns 1 through 3 0.0290 + 0.0002i 0.2674 + 0.0002i 0.5759 - 0.0004i Columns 4 through 6 0.8399 + 0.0005i 1.1082 - 0.0004i 1.3655 + 0.0001i Columns 7 through 9 1.6001 + 0.0003i 1.8256 - 0.0005i 2.0256 + 0.0005i Columns 10 through 12 2.2055 - 0.0003i 2.3633 - 0.0000i 2.4927 + 0.0003i Columns 13 through 15 2.5991 - 0.0005i 2.6765 + 0.0004i 2.7264 - 0.0002i Columns 16 through 18 2.7499 - 0.0001i 2.7442 + 0.0004i 2.7130 - 0.0004i Columns 19 through 21 2.6554 + 0.0003i 2.5724 - 0.0001i 2.4673 - 0.0002i Columns 22 through 24 2.3395 + 0.0003i 2.1928 - 0.0003i 2.0290 + 0.0002i Columns 25 through 27 1.8494 + 0.0000i 1.6584 - 0.0002i 1.4570 + 0.0003i Columns 28 through 30 1.2485 - 0.0002i 1.0364 + 0.0001i 0.8216 + 0.0001i Columns 31 through 33 0.6086 - 0.0002i 0.3991 + 0.0002i 0.1950 - 0.0001i Columns 34 through 36 0.0003 - 0.0000i -0.1850 + 0.0002i -0.3574 - 0.0002i Columns 37 through 39 -0.5156 + 0.0001i -0.6591 - 0.0000i -0.7851 - 0.0001i Columns 40 through 42 -0.8943 + 0.0002i -0.9854 - 0.0001i -1.0576 + 0.0000i Columns 43 through 45 -1.1124 + 0.0001i -1.1481 - 0.0002i -1.1667 + 0.0001i Columns 46 through 48 -1.1688 - 0.0001i -1.1542 - 0.0001i -1.1261 + 0.0002i Columns 49 through 51 -1.0840 - 0.0002i -1.0304 + 0.0001i -0.9674 + 0.0001i Columns 52 through 54 -0.8954 - 0.0002i -0.8179 + 0.0002i -0.7355 - 0.0002i Columns 55 through 57 -0.6506 + 0.0000i -0.5655 + 0.0002i -0.4807 - 0.0003i Columns 58 through 60 -0.3994 + 0.0002i -0.3224 - 0.0001i -0.2509 - 0.0001i Columns 61 through 63 -0.1871 + 0.0003i -0.1311 - 0.0003i -0.0844 + 0.0002i Columns 64 through 66 -0.0478 - 0.0000i -0.0210 - 0.0002i -0.0053 + 0.0004i Columns 67 through 69 -0.0000 - 0.0004i -0.0051 + 0.0002i -0.0205 + 0.0001i Columns 70 through 72 -0.0451 - 0.0003i -0.0784 + 0.0004i -0.1198 - 0.0004i Columns 73 through 75 -0.1673 + 0.0001i -0.2208 + 0.0002i -0.2782 - 0.0004i Columns 76 through 78 -0.3379 + 0.0005i -0.3999 - 0.0003i -0.4606 + 0.0000i Columns 79 through 81 -0.5203 + 0.0003i -0.5773 - 0.0005i -0.6286 + 0.0005i Columns 82 through 84 -0.6760 - 0.0003i -0.7150 - 0.0001i -0.7465 + 0.0004i Columns 85 through 87 -0.7705 - 0.0005i -0.7823 + 0.0004i -0.7870 - 0.0002i Columns 88 through 90 -0.7794 - 0.0002i -0.7607 + 0.0005i -0.7347 - 0.0005i Columns 91 through 93 -0.6931 + 0.0004i -0.6465 - 0.0000i -0.5886 - 0.0003i Columns 94 through 96 -0.5186 + 0.0005i -0.4503 - 0.0005i -0.3625 + 0.0003i Columns 97 through 99 -0.2794 + 0.0001i -0.1944 - 0.0004i -0.0794 + 0.0005i Column 100 -0.0282 - 0.0005i figure plot(real(ifft(ifftshift(freq2)))) signal = sin(pts) + sin(1.5*pts) + sin(2*pts) + sin(45*pts)*.05; close all n = 4; M = rand(M); M = M*M'+eye(n); eig(M) {Error using rand Size vector should be a row vector with real elements. } n = 4; M = rand(n); M = M*M'+eye(n); eig(M) ans = 1.0024 1.0868 1.2897 5.3532 n = 40; M = rand(n); M = M*M'+eye(n); eig(M) ans = 1.0000 1.0204 1.0327 1.0385 1.1022 1.1835 1.2344 1.2772 1.4596 1.5509 1.6021 1.7707 1.8149 1.9555 2.2100 2.3938 2.4478 2.5865 2.7003 2.8417 3.2626 3.5558 3.8654 3.9918 4.1198 4.6793 4.8116 5.2023 5.9060 6.1229 6.3474 6.8980 7.2899 7.5546 8.6194 9.4572 10.0656 10.6385 12.6638 407.1671 n = 40; M = rand(n); M = M*M'+eye(n); L = chol(M,'lower'); z=L\b; x=L'\z; norm(M*x-b) {Undefined function or variable 'b'. } n=40; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); z=L\b; x=L'\z; norm(M*x-b) ans = 1.7064e-14 n=40; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); z=L\b; x=L'\z; norm(M*x-b) ans = 5.2513e-15 n=40; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); z=L\b; x=L'\z; norm(M*x-b) ans = 1.8113e-14 n=40; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); z=L\b; x=L'\z; norm(M*x-b) ans = 8.0734e-15 n=400; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); z=L\b; x=L'\z; norm(M*x-b) ans = 1.1669e-12 n=400; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); z=L\b; x=L'\z; norm(M*x-b) ans = 1.6355e-12 n=400; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); z=L\b; x=L'\z; norm(M*x-b) ans = 2.3704e-12 n=400; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); z=L\b; x=L'\z; norm(M*x-b) ans = 2.1587e-12 n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); tic; z=L\b; x=L'\z; toc Elapsed time is 0.000450 seconds. n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); tic; z=L\b; x=L'\z; toc Elapsed time is 0.000313 seconds. n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); tic; z=L\b; x=L'\z; toc Elapsed time is 0.000266 seconds. n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); L=chol(M,'lower'); tic; z=L\b; x=L'\z; toc Elapsed time is 0.000296 seconds. n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.000714 seconds. clc clc n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.000840 seconds. n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.000701 seconds. n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.000930 seconds. n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.000717 seconds. n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.000813 seconds. n=100; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.000848 seconds. n=500; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.001618 seconds. n=500; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.001796 seconds. n=500; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.001810 seconds. n=500; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.001913 seconds. n=1000; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.006222 seconds. n=5000; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.372981 seconds. n=5000; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.392133 seconds. n=5000; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.383055 seconds. n=5000; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.388970 seconds. n=5; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; x=inv(M)*b; norm(M*x-b) ans = 4.0030e-16 n=50; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; x=inv(M)*b; norm(M*x-b) ans = 2.9350e-13 n=50; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; x=inv(M)*b; norm(M*x-b) ans = 2.0913e-13 n=500; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; x=inv(M)*b; norm(M*x-b) ans = 1.9015e-09 n=500; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; x=inv(M)*b; norm(M*x-b) ans = 1.0975e-09 n=500; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; x=inv(M)*b; norm(M*x-b) ans = 2.5665e-10 n=500; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; x=inv(M)*b; toc Elapsed time is 0.005725 seconds. n=5000; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; L=chol(M,'lower'); z=L\b; x=L'\z; toc Elapsed time is 0.384933 seconds. n=5000; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; x=inv(M)*b; toc Elapsed time is 2.183554 seconds. n=5000; M=rand(n); M=M*M'+eye(n); b=rand(n,1); tic; x=M\b; toc Elapsed time is 0.452595 seconds. help backslash backslash not found. Use the Help browser search field to search the documentation, or type "help help" for help command options, such as help for methods. help \ \ Backslash or left matrix divide. A\B is the matrix division of A into B, which is roughly the same as INV(A)*B , except it is computed in a different way. If A is an N-by-N matrix and B is a column vector with N components, or a matrix with several such columns, then X = A\B is the solution to the equation A*X = B. A warning message is printed if A is badly scaled or nearly singular. A\EYE(SIZE(A)) produces the inverse of A. If A is an M-by-N matrix with M < or > N and B is a column vector with M components, or a matrix with several such columns, then X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations A*X = B. The effective rank, K, of A is determined from the QR decomposition with pivoting. A solution X is computed which has at most K nonzero components per column. If K < N this will usually not be the same solution as PINV(A)*B. A\EYE(SIZE(A)) produces a generalized inverse of A. C = mldivide(A,B) is called for the syntax 'A \ B' when A or B is an object. See also ldivide, rdivide, mrdivide. Other functions named mldivide Reference page in Help browser doc mldivide help ldivide .\ Left array divide. A.\B denotes element-by-element division. A and B must have the same dimensions unless one is a scalar. A scalar can be divided with anything. C = ldivide(A,B) is called for the syntax 'A .\ B' when A or B is an object. See also rdivide, mrdivide, mldivide. Other functions named ldivide Reference page in Help browser doc ldivide help mldivide \ Backslash or left matrix divide. A\B is the matrix division of A into B, which is roughly the same as INV(A)*B , except it is computed in a different way. If A is an N-by-N matrix and B is a column vector with N components, or a matrix with several such columns, then X = A\B is the solution to the equation A*X = B. A warning message is printed if A is badly scaled or nearly singular. A\EYE(SIZE(A)) produces the inverse of A. If A is an M-by-N matrix with M < or > N and B is a column vector with M components, or a matrix with several such columns, then X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations A*X = B. The effective rank, K, of A is determined from the QR decomposition with pivoting. A solution X is computed which has at most K nonzero components per column. If K < N this will usually not be the same solution as PINV(A)*B. A\EYE(SIZE(A)) produces a generalized inverse of A. C = mldivide(A,B) is called for the syntax 'A \ B' when A or B is an object. See also ldivide, rdivide, mrdivide. Other functions named mldivide Reference page in Help browser doc mldivide doc mldivide lu,qr,chol {Error using lu Not enough input arguments. } eig,svd {Error using eig Not enough input arguments. } M = [2 4; -6 8] M = 2 4 -6 8 v([ 4 3 1 2 ]) = [ M(1,:), M(2,:) ] v = -6 8 4 2 sin(pi) ans = 1.2246e-16 2^54+2 ans = 1.8014e+16 2^54+2==2^54 ans = 1 t = rand t = 0.7587 s=single(t) s = 0.7587 d=double(s) d = 0.7587 s==d ans = 1 clc sin(pi) ans = 1.2246e-16 b = 2 b = 2 whos('b') Name Size Bytes Class Attributes b 1x1 8 double 2^54+2==2^54 ans = 1 2^53+2==2^53 ans = 0 clc double(single(pi)) == single(pi) ans = 1 diary