In max-plus algebra
where x , y denote the entries.
How two multiply two matrices in MATLAB such that addition implies maximum value and multiplication imply sum .
You will need to write the code, overloading + and * (thus the functions plus and mtimes) for inputs of class double. Then you need to learn how to overload operators in MATLAB.
This is a VERY bad idea, because that will completely disable addition or multiplication of matrices when next you use MATLAB for some other project. Worse, other functions in MATLAB will now fail, if they use addition or multiplication. Even scalar multiplies or adds will now fail to work properly.
As I said, that is just an insanely bad idea.
Instead, just write two functions myplus and mytimes (call them what you want, as long as they are not plus and times) that operate exactly as you wish. Then use them to compute the desired results, wherever you want those operations.