You can use the max
function to find the largest element of the array. In this case, f
is not a valid array in MATLAB syntax. You can define f
as follows:
main.m19 chars2 lines
Then, you can find the largest positive element as follows:
main.m20 chars2 lines
This code will output the largest positive element in f
. If f
does not contain any positive elements, m_inf
will be an empty array ([]
).
gistlibby LogSnag