0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 mc
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %% Some AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 c1 = ao(1); c1.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 c2 = ao(2); c2.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 c3 = ao(3); c3.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 c4 = ao(randn(3,3)); c4.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 c5 = ao(randn(3,3)); c5.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 c6 = ao(randn(3,1)); c6.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 c7 = ao(randn(1,3)); c7.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 t1 = ao(plist('tsfcn', 't', 'fs', 10, 'nsecs', 10)); t1.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 t2 = ao(plist('tsfcn', 'sqrt(t)', 'fs', 10, 'nsecs', 10)); t2.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 t3 = ao(plist('tsfcn', 't.^2', 'fs', 10, 'nsecs', 10)); t3.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 f1 = ao(plist('fsfcn', 'f', 'f', 'logspace(-4,1,100)')); f1.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 f2 = ao(plist('fsfcn', '1./f', 'f', 'logspace(-4,1,100)')); f2.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 f3 = ao(plist('fsfcn', 'sqrt(f)', 'f', 'logspace(-4,1,100)')); f3.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 x1 = ao(plist('xyfcn', 'x', 'x', '1:100')); x1.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 x2 = ao(plist('xyfcn', '1./x', 'x', '1:100')); x2.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 x3 = ao(plist('xyfcn', 'sqrt(x)', 'x', '1:100')); x3.setName;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 %% Rule 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 %---------- CDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % cdata + cdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 r1 = plus(c1,c3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 % cdata + tsdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 r2 = plus(c1,t1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % cdata + fsdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 r3 = plus(c1,f1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % cdata + xydata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 r4 = plus(c1,x1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 %---------- TSDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 % tsdata + tsdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 r5 = plus(t1, t2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 % tsdata + fsdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 r6 = plus(t1, f2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 error('Data types should be incompatible: booo!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 warning('Data types not compatible: fsdata+tsdata: hoorah!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 % tsdata + xydata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 r7 = plus(t1, x2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 % tsdata + cdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 r8 = plus(t1, c2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 %---------- FSDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 % fsdata + tsdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 r9 = plus(f1, t2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 error('Data types should be incompatible: booo!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 warning('Data types not compatible: fsdata+tsdata: hoorah!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 % fsdata + fsdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 r10 = plus(f1, f2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 % fsdata + xydata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 r11 = plus(f1, x2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 % fsdata + cdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 r12 = plus(f1, c2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 %---------- XYDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 % xydata + tsdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 r13 = plus(x1, t2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 % xydata + fsdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 r14 = plus(x1, f2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 % xydata + xydata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 r15 = plus(x1, x2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 % xydata + cdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 r16 = plus(x1, c2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 %% Rule 2: vector + single
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 v = [t1 t2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 s = c2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 % one output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 r1 = plus(v,s)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 r2 = plus(s,v)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 % multiple outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 [r1 r2] = plus(v,s)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 %% Rule 2: vector + number
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 v = [t1 t2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 % one output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 r1 = plus(v,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 r2 = plus(2,v)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 %% Rule 3: V_N + V_M
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 v1 = [t1 t2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 v2 = [c1 c2 c3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 r = plus(v1,v2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 error('Rule 3 should fail: booo!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 warning('Rule 3 fails: hoorah!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 %% Rule 4: V_N + U_N
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 v1 = [t1 t2 t3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 v2 = [x1 x2 x3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 r = plus(v1,v2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 [r1 r2 r3] = plus(v1,v2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 %% Rule 5: matrix + single
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 m = [t1 t2 t3; x1 x2 x3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 s = c2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 r1 = plus(m,s);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 r2 = plus(s,m);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 %% Rule 6: matrix + column vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 m = [t1 t2 t3; x1 x2 x3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 v = [c1; c2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 r1 = plus(m,v)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 r2 = plus(v,m)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 %% Rule 7: matrix + row vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 m = [t1 t2 t3; x1 x2 x3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 v = [c1 c2 c3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 r1 = plus(m,v)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 r2 = plus(v,m)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 %% Rule 8: M_NP + V_1Q (or V_Q1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 m = [t1 t2 t3; x1 x2 x3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 v = [c1 c2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 r = plus(m,v)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 error('Rule 8 should fail: booo!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 warning('Rule 8 fails: hoorah!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 r = plus(v,m)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 error('Rule 8 should fail: booo!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 warning('Rule 8 fails: hoorah!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 m = [t1 t2 t3; x1 x2 x3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 v = [c1; c2; c3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 r = plus(m,v)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 error('Rule 8 should fail: booo!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 warning('Rule 8 fails: hoorah!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 r = plus(v,m)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 error('Rule 8 should fail: booo!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 warning('Rule 8 fails: hoorah!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 %% Rule 9: M_NP + H_PQ
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 m = [t1 t2; x1 x2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 h = [c1 c2 c3; c1 c2 c3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 r = plus(m,h)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 error('Rule 9 should fail: booo!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 warning('Rule 9 fails: hoorah!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 %% Rule 10: matrix + matrix
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 m = [t1 t2 t3; x1 x2 x3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 h = [c1 c2 c3; c1 c2 c3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 r = plus(m,h)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 %% Rule 11: more than two inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 m = [t1 t2 t3; x1 x2 x3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 v = [c1; c2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 r = plus(m,v, c3, v, m)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 %% Check units
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 % empty + m = m
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 t1.setYunits('m');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 t2.setYunits('');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 r = plus(t1,t2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 % V + m = error
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 t2.setYunits('V');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 r = plus(t1,t2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 error('This unit check should fail: booo!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 warning('The unit check failed: hoorah!');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232
|