- Timestamp:
- Mar 14, 2008, 10:56:48 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sample/miscellaneous/sample_matrix.mso
r247 r485 18 18 * Author: Rodolfo Rodrigues 19 19 * $Id: Matrix_Function.mso 89 2006-12-14 20:29:34Z bicca $ 20 *------------------------------------------------------------------ --*#20 *------------------------------------------------------------------*# 21 21 # 22 22 # EMSO sample file of matrix functions … … 37 37 * Given the matrix A: 38 38 * 39 * |- 1 -2 3 10|40 * | 0 -1 -1 02|41 * | 0 0 5 10|39 * |-2 3 1 0| 40 * |-1 -1 0 2| 41 * | 0 5 1 0| 42 42 * 43 43 *--------------------------------------------------*# … … 48 48 N as Integer; 49 49 A(M,N) as Real; 50 50 51 51 52 VARIABLES … … 58 59 Transp_(N,M)as Real; 59 60 61 60 62 SET 61 M = 5; # columns62 N = 3; # rows63 M = 3; # rows 64 N = 4; # columns 63 65 64 A(:,1) = [-1, -2, 3, 1, 0]; 65 A(:,2) = [ 0, -1, -1, 0, 2]; 66 A(:,3) = [ 0, 0, 5, 1, 0]; 66 A(:,1) = [-2, -1, 0]; 67 A(:,2) = [ 3, -1, 5]; 68 A(:,3) = [ 1, 0, 1]; 69 A(:,4) = [ 0, 2, 0]; 70 67 71 68 72 EQUATIONS 73 #*--------------------------------------------------- 74 * 75 * |-2 3 1 0| 76 * sum|-1 -1 0 2| = |-3 7 2 2| 77 * | 0 5 1 0| 78 * 79 *---------------------------------------------------*# 69 80 "Function sum" 70 81 Sum_ = sum(A); 71 82 83 84 #*--------------------------------------------------- 85 * 86 * |-2 3 1 0| | 2| 87 * sumt|-1 -1 0 2| = | 0| 88 * | 0 5 1 0| | 6| 89 * 90 *---------------------------------------------------*# 72 91 "Function sumt" 73 92 Sumt_ = sumt(A); 74 93 94 95 #*--------------------------------------------------- 96 * 97 * |-2 3 1 0| 98 * prod|-1 -1 0 2| = | 0 -15 0 0| 99 * | 0 5 1 0| 100 * 101 *---------------------------------------------------*# 75 102 "Function prod" 76 103 Prod_ = prod(A); 77 104 105 106 #*--------------------------------------------------- 107 * 108 * |-2 3 1 0| | 0| 109 * prodt|-1 -1 0 2| = | 0| 110 * | 0 5 1 0| | 0| 111 * 112 *---------------------------------------------------*# 78 113 "Function prod" 79 114 Prodt_ = prodt(A); 80 115 116 117 #*--------------------------------------------------- 118 * 119 * |-2 3 1 0| |-2 -1 0| 120 * transp|-1 -1 0 2| = | 3 -1 5| 121 * | 0 5 1 0| | 1 0 1| 122 * | 0 2 0| 123 * 124 *---------------------------------------------------*# 81 125 "Function transp" 82 126 Transp_ = transp(A); 127 83 128 84 129 OPTIONS
Note: See TracChangeset
for help on using the changeset viewer.