MATLAB: Combinations with constraint

combinationsoptimization wavelengthsreflectancespectra

Hi There,
I am a matlab newbie and I have a spectral reflectance data set that I need to work with. The data is arrange is columns with the wavelengths being the header (i.e from 400nm to 2400 nm). I want to have all possible two-pair combination for the formula (?1-?2)/(?1+?2) where ?1 is greater than ?2. ? represents the wavelengths or the column headers.
Hope someone out there will help me to solve this problem.
Any assistance will be greatly appreciated.
Andy

Best Answer

doc meshgrid
Then apply your constraints to blank out entries. Depending on what you're doing with them you may be able to skip the overhead of creating all of the combinations by using BSXFUN to set it up for you and applying the constraint internally.