about summary refs log tree commit diff
path: root/usth/MATH2.4/labwork/5/profit.m
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-02-16 14:26:55 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-02-16 14:26:55 +0700
commit82e6cf7d1046d6cee16f7e8b044ec33e7ec6c4b7 (patch)
treef7b7ae0bce69070c47a1b31a85bd2bc69dfecf09 /usth/MATH2.4/labwork/5/profit.m
parent29d1001e2e21eff289bff23412e284c8b2e44595 (diff)
downloadcp-82e6cf7d1046d6cee16f7e8b044ec33e7ec6c4b7.tar.gz
[usth] Numerical Method is MATH2.4
Diffstat (limited to 'usth/MATH2.4/labwork/5/profit.m')
-rw-r--r--usth/MATH2.4/labwork/5/profit.m15
1 files changed, 15 insertions, 0 deletions
diff --git a/usth/MATH2.4/labwork/5/profit.m b/usth/MATH2.4/labwork/5/profit.m
new file mode 100644
index 0000000..b196205
--- /dev/null
+++ b/usth/MATH2.4/labwork/5/profit.m
@@ -0,0 +1,15 @@
+function z = profit (x, y)
+  A = [7 11; 10 8];
+  b = [77; 80];
+  c = [150; 175];
+  [m n] = size (x);
+  z = -inf (m, n);
+  for s = 1 : m
+    for t = 1 : n
+      r = [x(s, t); y(s, t)];
+      if A * r <= b
+        z(s, t) = dot (c, r);
+      endif
+    endfor
+  endfor
+endfunction