octave:2> x=linspace(0,1,11) x = Columns 1 through 7: 0.00000 0.10000 0.20000 0.30000 0.40000 0.50000 0.60000 Columns 8 through 11: 0.70000 0.80000 0.90000 1.00000 octave:3> x <= 0.5 ans = 1 1 1 1 1 1 0 0 0 0 0 octave:4> x >= 0.25 & x<=0.75 ans = 0 0 0 1 1 1 1 1 0 0 0 octave:5> (x >= 0.25 & x<=0.75)*2 ans = 0 0 0 2 2 2 2 2 0 0 0 octave:6> idx = x >= 0.25 & x<=0.75 idx = 0 0 0 1 1 1 1 1 0 0 0 octave:7> x(idx) ans = 0.30000 0.40000 0.50000 0.60000 0.70000 octave:8> idx=[0,0,0,1,1,1,1,1,0,0,0] idx = 0 0 0 1 1 1 1 1 0 0 0 octave:9> x(idx) error: subscript indices must be either positive integers less than 2^31 or logicals octave:9> idx1 = x >= 0.25 & x<=0.75 idx1 = 0 0 0 1 1 1 1 1 0 0 0 octave:10> idx2=[0,0,0,1,1,1,1,1,0,0,0] idx2 = 0 0 0 1 1 1 1 1 0 0 0 octave:11> whos Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== ans 1x5 40 double idx 1x11 88 double idx1 1x11 11 logical idx2 1x11 88 double x 1x11 88 double Total is 49 elements using 315 bytes octave:12> idx3=2*idx1 idx3 = 0 0 0 2 2 2 2 2 0 0 0 octave:13> whos Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== ans 1x5 40 double idx 1x11 88 double idx1 1x11 11 logical idx2 1x11 88 double idx3 1x11 88 double x 1x11 88 double Total is 60 elements using 403 bytes octave:14> idx4=1-idx1 idx4 = 1 1 1 0 0 0 0 0 1 1 1 octave:15> whos Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== ans 1x5 40 double idx 1x11 88 double idx1 1x11 11 logical idx2 1x11 88 double idx3 1x11 88 double idx4 1x11 88 double x 1x11 88 double Total is 71 elements using 491 bytes octave:16> x(idx4) error: subscript indices must be either positive integers less than 2^31 or logicals octave:16> idx idx = 0 0 0 1 1 1 1 1 0 0 0 octave:17> idx~=idx ans = 0 0 0 0 0 0 0 0 0 0 0 octave:18> ~idx1 ans = 1 1 1 0 0 0 0 0 1 1 1 octave:19> ~idx ans = 1 1 1 0 0 0 0 0 1 1 1 octave:20> idx5=~idx idx5 = 1 1 1 0 0 0 0 0 1 1 1 octave:21> whos Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== ans 1x11 11 logical idx 1x11 88 double idx1 1x11 11 logical idx2 1x11 88 double idx3 1x11 88 double idx4 1x11 88 double idx5 1x11 11 logical x 1x11 88 double Total is 88 elements using 473 bytes octave:22> x(idx5) ans = 0.00000 0.10000 0.20000 0.80000 0.90000 1.00000 octave:23> fem0 ans = 9.4369e-16 ans = 2.2413e-04 octave:24> fem0 ans = 9.4369e-16 ans = 2.2413e-04 octave:25> max(h)^2 ans = 0.0017361 octave:26> m m = 37 octave:27> fem0 ans = 2.3037e-15 ans = 8.9404e-05 octave:28> fem0 ans = 2.6368e-15 ans = 4.7744e-05 octave:29> loglog([40,60,80],[2.2413e-04,8.9404e-05,4.7744e-05],'*') octave:30> loglog([40,60,80],[2.2413e-04,8.9404e-05,4.7744e-05],'*',[40,60,80],[40,60,80].^(-2)) octave:31> fem0 ans = 4.3368e-19 ans = 0.0080687 octave:32> fem0 ans = 0.0039063 ans = 0.0024269 octave:33> fem0 ans = 0.0018029 ans = 0.0010770 octave:34> fem0 ans = 0.0039063 ans = 0.0024269 octave:35> fem0 ans = 0.0024671 ans = 0.0014922 octave:36> fem0 ans = 0.0018029 ans = 0.0010770 octave:37> loglog([40,60,80],[0.0024269,0.0014922,0.0010770],[40,60,80],[40,60,80].^(-2)) octave:38> loglog([40,60,80],[0.0024269,0.0014922,0.0010770],'*',[40,60,80],[40,60,80].^(-2)) octave:39> loglog([40,60,80],[0.0024269,0.0014922,0.0010770],'*',[40,60,80],[40,60,80]) octave:40> loglog([40,60,80],[0.0024269,0.0014922,0.0010770],'*',[40,60,80],[40,60,80].^(-1)) octave:41> loglog([40,60,80],[0.0024269,0.0014922,0.0010770],'*',[40,60,80],[40,60,80].^(-1/2)) octave:42> loglog([40,60,80],[0.0024269,0.0014922,0.0010770],'*',[40,60,80],[40,60,80].^(-3/2)) octave:43> loglog([40,60,80],[0.0024269,0.0014922,0.0010770],'*',[40,60,80],[40,60,80].^(-2)) octave:44> fem0 ans = 0.50000 ans = 0.28886 octave:45> fem0 ans = 0.50000 ans = 0.28886 octave:46> fem0 ans = 0.50000 ans = 0.28886 octave:47> fem0 ans = 1.7592e+13 ans = 1.7601e+13 octave:48> 1i=5 parse error: invalid constant left hand side of assignment >>> 1i=5 ^ octave:48> 2i ans = 0 + 2i octave:49> 2*1i ans = 0 + 2i octave:50> 3.5i ans = 0.00000 + 3.50000i octave:51> v=rand(1,4)+1i*rand(1,4) v = Columns 1 through 3: 0.37473 + 0.82189i 0.07889 + 0.54588i 0.49412 + 0.49663i Column 4: 0.07736 + 0.94942i octave:52> v=rand(1,3)+1i*rand(1,3) v = 0.57757 + 0.47374i 0.14376 + 0.84113i 0.00837 + 0.39381i octave:53> v' ans = 0.57757 - 0.47374i 0.14376 - 0.84113i 0.00837 - 0.39381i octave:54> v.' ans = 0.57757 + 0.47374i 0.14376 + 0.84113i 0.00837 + 0.39381i octave:55> x=[-2;2] x = -2 2 octave:56> k=1:2 k = 1 2 octave:57> [exp(k(1)*x);exp(k(2)*x)] ans = 0.135335 7.389056 0.018316 54.598150 octave:58> [exp(k(1)*x');exp(k(2)*x')] ans = 0.135335 7.389056 0.018316 54.598150 octave:59> exp(k'*x) error: operator *: nonconformant arguments (op1 is 2x1, op2 is 2x1) error: evaluating argument list element number 1 octave:59> exp(k'*x') ans = 0.135335 7.389056 0.018316 54.598150 octave:60> k k = 1 2 octave:61> x x = -2 2 octave:62> diary off