about summary refs log tree commit diff
path: root/usth/MATH2.4/labwork/5/profit.m
blob: b196205a44a80e41648ca80c56669ae5476f90df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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