Presuming I infer your meaning precisely...
>> x=randi(200,4,3)
x =
127 182 88
198 115 121
127 68 145
121 192 136
>> y=diff(x,[],2)
y =
55 -94
-83 6
-59 77
71 -56
>> y=bsxfun(@mrdivide,y,range(y))
y =
0.3571 -0.5497
-0.5390 0.0351
-0.3831 0.4503
0.4610 -0.3275
>>
NB: In recent releases of Matlab, the above expansion using bsxfun will be done automagically simply by writing
I'm limited to R2014b here which predates that syntax introduction...
Best Answer