From e461df7573c2b7b7e26c965d8cf2d8e175d67378 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Mon, 16 Dec 2019 21:31:18 +0700 Subject: [usth/MATH2.2] Numerical Methods The future starts now. --- usth/MATH2.2/labwork/5/profit.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 usth/MATH2.2/labwork/5/profit.m (limited to 'usth/MATH2.2/labwork/5/profit.m') diff --git a/usth/MATH2.2/labwork/5/profit.m b/usth/MATH2.2/labwork/5/profit.m new file mode 100644 index 0000000..b196205 --- /dev/null +++ b/usth/MATH2.2/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 -- cgit 1.4.1