@DrGreenEggsandIronMan Oh right, it was basically hard-coded for the example you wanted. It's generalizable but long. Did you have a specific question in mind?
@DrGreenEggsandIronMan Haha. Actually @beaker suggested that some time ago. But he said "chattel" has a slightly negative meaning (I'm no native speaker). What do you guys think? Maybe I'll rename it for a while, if @beaker agrees
@DrGreenEggsandIronMan Actually the order of the inputs for Z^ should be: first the array of values, then the number. They can be reversed as in my example, but then the array can't be a single number because the inputs would be interpreted in the other order (a number is the same as a 1x1 array in MATL)