How to find maximums and then receive coordinates in every single row to implement Von Stackelberg equlibrium.

3 views (last 30 days)
Hi, I have to make small program, which will find result of Von Stackelber equilibrium for max. It can work just for 3x3 matrices. Let's say I have A = [-5 3 -8; 4 1 5; 1 7 7]; B = [-3 2 1;-5 4 4;6 2 1]; For first I have to find the max values in every row in matrix B, then take the values in matrix A, which corresponds to these in matrix B(need to find coordinates of max, also when we have two or three the same max values), then from this values for every row from A we pick the smallest(min) and finally we take the biggest. This is the result but we need also number in which row contains it. Briefly, the algorith is Max -> Min -> Max. The biggest porblem for me is how to find the coordinates when we have more than one maximum in given row and then how to reject the bad ones.
Thanks,
Paul.

Answers (1)

Star Strider
Star Strider on 13 Jan 2016
This will find repeated values of every maximum in each row of ‘B’ and find the corresponding elements in ‘A’. This should get you started. The rest I cannot follow.
A = [-5 3 -8; 4 1 5; 1 7 7];
B = [-3 2 1;-5 4 4;6 2 1];
for k1 = 1:size(B,1)
Ix{k1} = B(k1,:) == max(B(k1,:)); % Logical Indes Of Maximum Values In Each Row Of ‘B’
Ac{k1} = A(k1,Ix{k1}); % Corresponding Elements In Each Row Of ‘A’
end

Categories

Find more on Cartesian Coordinate System Conversion in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!