Mathematica How Can I Compute the Saturation of Each Element in a Matrix Using Mathematica?

AI Thread Summary
To compute the saturation for each element in the n x n matrices using the minimum valued matrix, first identify the matrix with the lowest values across corresponding elements of the three color channel matrices (r, g, b). This can be achieved by applying the `Min` function element-wise to the matrices. Once the minimum matrix is obtained, apply the saturation function S:=1-3(Min r,g,b) to each element of this minimum matrix. This will yield an n x n matrix where each element represents the computed saturation based on the minimum values from the original matrices. Ensure that the function is applied correctly to maintain the matrix structure, rather than returning a single value.
Agent M27
Messages
169
Reaction score
0
I have three n x n matrices for which I am try to compute the saturation of each element in the matrix. The function to find this is S:=1-3(Min r,g,b) where r,g,b are the color channel matrices. For my output I am trying to get it to return an n x n matrix with each element having the function S applied to it. When I run that code it returns a single value, not a matrix, that is between 0 & 1, which is not correct. If I change the function S for example, to be S:=1-3b, it returns the desired result of the original n x n matrix after the function has been applied. So what I think mathematica is doing is, it is comparing the elements of the three matrices and using the lowest value of all elements to compute, but what I need it to do is take the minimum valued matrix and then compute the saturation for it. Any assistance would be appreciated. Thanks.

Joe
 
Physics news on Phys.org
The documentation for Min says if it is given lists then it yields the smallest element of any of the lists and a couple seconds of experimenting seems to show this happens no matter how the lists are nested. So your guess about what it is doing appears to be correct.

Please describe simply and clearly how to "take the minimum valued matrix" and "then compute the saturation for it."
 

Similar threads

Back
Top