str1 = -------------------> Session (re)starting: 04-Feb-2008 09:33:21 draw2 ??? Error using ==> min MIN with two matrices to compare and a working dimension is not supported. Error in ==> draw2 at 69 minimum_n = min(min(saxpy(:,1)), min(dotpxy(:,1)), min(dotpxx(:,1))); Warning: Connection to the X11 Display Server (:0.0) has been lost. No more graphics windows can no longer be displayed in this session. Graphics Objects can still be printed, and all commands should still work. We recommend that you try to save your current session and exit str1 = -------------------> Session (re)starting: 04-Feb-2008 09:38:11 draw2 ??? Error using ==> min MIN with two matrices to compare and a working dimension is not supported. Error in ==> draw2 at 69 minimum_n = min(min(saxpy(:,1)), min(dotpxy(:,1)), min(dotpxx(:,1))); Warning: Connection to the X11 Display Server (:0.0) has been lost. No more graphics windows can no longer be displayed in this session. Graphics Objects can still be printed, and all commands should still work. We recommend that you try to save your current session and exit str1 = -------------------> Session (re)starting: 04-Feb-2008 09:39:57 t1 = rand(1,1) t1 = 0.81472 t2 = rand(1,1) t2 = 0.90579 t3 = rand(1,1) t3 = 0.12699 t = min(t1, t2, t3) ??? Error using ==> min MIN with two matrices to compare and a working dimension is not supported. help min MIN Smallest component. For vectors, MIN(X) is the smallest element in X. For matrices, MIN(X) is a row vector containing the minimum element from each column. For N-D arrays, MIN(X) operates along the first non-singleton dimension. [Y,I] = MIN(X) returns the indices of the minimum values in vector I. If the values along the first non-singleton dimension contain more than one minimal element, the index of the first one is returned. MIN(X,Y) returns an array the same size as X and Y with the smallest elements taken from X or Y. Either one can be a scalar. [Y,I] = MIN(X,[],DIM) operates along the dimension DIM. When X is complex, the minimum is computed using the magnitude MIN(ABS(X)). In the case of equal magnitude elements, then the phase angle MIN(ANGLE(X)) is used. NaN's are ignored when computing the minimum. When all elements in X are NaN's, then the first one is returned as the minimum. Example: If X = [2 8 4 then min(X,[],1) is [2 3 4], 7 3 9] min(X,[],2) is [2 and min(X,5) is [2 5 4 3], 5 3 5]. See also MAX, MEDIAN, MEAN, SORT. Overloaded functions or methods (ones with the same name in other directories) help timeseries/min.m help ordinal/min.m whos Name Size Bytes Class Attributes str0 1x13 26 char str1 1x63 126 char t1 1x1 8 double t2 1x1 8 double t3 1x1 8 double size([t1, t2, t3]) ans = 1 3 clear all pi ans = 3.1416 pi = -4.2 pi = -4.2 clear all pi ans = 3.1416 draw5 min_saxpy = 100 min_dotpxy = 100 min_dotpxx = 100 array_of_mins = 100 100 100 minimum_n = 100 Warning: Connection to the X11 Display Server (:0.0) has been lost. No more graphics windows can no longer be displayed in this session. Graphics Objects can still be printed, and all commands should still work. We recommend that you try to save your current session and exit str1 = -------------------> Session (re)starting: 04-Feb-2008 09:46:50 date ans = 04-Feb-2008 draw5 min_saxpy = 100 min_dotpxy = 100 min_dotpxx = 100 array_of_mins = 100 100 100 minimum_n = 100 exit str1 = -------------------> Session (re)starting: 04-Feb-2008 09:49:38 draw6 whos Name Size Bytes Class Attributes X 2x7 112 double Y 2x7 112 double array_of_mins 1x3 24 double dotpxx 9901x2 158416 double dotpxy 9901x2 158416 double exponents 1x7 56 double first_exponent 1x1 8 double info_string 1x60 120 char l 1x1 8 double largest_Mflop 1x1 8 double last_exponent 1x1 8 double maximum_n 1x1 8 double min_dotpxx 1x1 8 double min_dotpxy 1x1 8 double min_saxpy 1x1 8 double minimum_n 1x1 8 double powers_of_two 1x7 56 double saxpy 9901x2 158416 double str0 1x13 26 char str1 1x63 126 char v 1x7 56 double w 1x7 56 double X X = 128 256 512 1024 2048 4096 8192 128 256 512 1024 2048 4096 8192 Y Y = 0 0 0 0 0 0 0 993.54 993.54 993.54 993.54 993.54 993.54 993.54 ccc draw10 exit str1 = -------------------> Session (re)starting: 04-Feb-2008 10:05:29 %----------------- Start of Relops Stuff --------------------------- flop_equality should_be_true = 0 type flop_equality.m % % For A321 course % % Last Modified: Mon 04 Feb 2008, 09:05 AM % should_be_true = ( (-0.08 + 0.5 - 0.42) == (0.5 - 0.42 - 0.08)) t1 = (-0.08 + 0.5 - 0.42) t1 = 0 t2 = (0.5 - 0.42 - 0.08) t2 = 1.3878e-17 ccc logops a = -3 -2 -1 0 1 2 3 4 5 ans = 0 0 0 1 0 0 0 0 0 ~a ans = 0 0 0 1 0 0 0 0 0 -a ans = 3 2 1 0 -1 -2 -3 -4 -5 %------------------- relops.m ------------------------ relops a = 1 2 3 4 5 6 7 8 9 ans = 0 0 0 0 1 1 1 1 1 ans = 1 1 1 0 0 0 0 0 0 ans = 0 0 0 1 1 1 1 1 1 ans = 1 1 1 1 0 0 0 0 0 ans = 0 0 0 1 0 0 0 0 0 ans = 1 1 1 0 1 1 1 1 1 a >= 4 ans = 0 0 0 1 1 1 1 1 1 a <= 4 ans = 1 1 1 1 0 0 0 0 0 a == 4 ans = 0 0 0 1 0 0 0 0 0 a = 4 a = 4 clear all; clc b = -4:4 b = -4 -3 -2 -1 0 1 2 3 4 abs(b) > 2 ans = 1 1 0 0 0 0 0 1 1 d = b(abs(b) > 2) d = -4 -3 3 4 % abs(b) > 2 gives a logical array, not an array of integers d = b([1 1 0 0 0 0 0 1 1]) ??? Subscript indices must either be real positive integers or logicals. % Note: the array [1 1 0 0 0 0 0 1 1] is an array of numerical values, not a logical array! t = abs(b) > 2 t = 1 1 0 0 0 0 0 1 1 whos Name Size Bytes Class Attributes ans 1x9 9 logical b 1x9 72 double d 1x4 32 double t 1x9 9 logical d = b(t) d = -4 -3 3 4 numarray = [1 1 0 0 0 0 0 1 1] numarray = 1 1 0 0 0 0 0 1 1 whos Name Size Bytes Class Attributes ans 1x9 9 logical b 1x9 72 double d 1x4 32 double numarray 1x9 72 double t 1x9 9 logical logarray = logic(numarray) ??? Undefined function or method 'logic' for input arguments of type 'double'. logarray = logical(numarray) logarray = 1 1 0 0 0 0 0 1 1 whos Name Size Bytes Class Attributes ans 1x9 9 logical b 1x9 72 double d 1x4 32 double logarray 1x9 9 logical numarray 1x9 72 double t 1x9 9 logical x = logarray - numarray x = 0 0 0 0 0 0 0 0 0 whos Name Size Bytes Class Attributes ans 1x9 9 logical b 1x9 72 double d 1x4 32 double logarray 1x9 9 logical numarray 1x9 72 double t 1x9 9 logical x 1x9 72 double % Stuff works for double indexed arrays G = [ 5 -2; 2 -4] G = 5 -2 2 -4 abs(G) > 2 ans = 1 0 0 1 X = abs(G) > 2 X = 1 0 0 1 whos Name Size Bytes Class Attributes G 2x2 32 double X 2x2 4 logical ans 2x2 4 logical b 1x9 72 double d 1x4 32 double logarray 1x9 9 logical numarray 1x9 72 double t 1x9 9 logical x 1x9 72 double y = G(X) y = 5 -4 whos Name Size Bytes Class Attributes G 2x2 32 double X 2x2 4 logical ans 2x2 4 logical b 1x9 72 double d 1x4 32 double logarray 1x9 9 logical numarray 1x9 72 double t 1x9 9 logical x 1x9 72 double y 2x1 16 double % What if X was all logical falses? X = logical(zeros(2,2)) X = 0 0 0 0 z = G(X) z = Empty matrix: 0-by-1 whos Name Size Bytes Class Attributes G 2x2 32 double X 2x2 4 logical ans 2x2 4 logical b 1x9 72 double d 1x4 32 double logarray 1x9 9 logical numarray 1x9 72 double t 1x9 9 logical x 1x9 72 double y 2x1 16 double z 0x1 0 double % Single and double indexing A = [ 1 2 3 4 5 6] A = 1 2 3 4 5 6 max(A) ans = 5 6 max(max(A)) ans = 6 max(A(:)) ans = 6 A(:) ans = 1 3 5 2 4 6 exit str1 = -------------------> Session (re)starting: 04-Feb-2008 10:53:35 exit