MATLAB: The difference between a value and a set of values

alk

a=( 2743.727 2743.727 2743.727 2743.727 )
b=( 2304.763 2304.763 2402.288 2304.764 2304.764 )
How can I calculate the matrix
c=
11-11 21-11 31-11 41-11
11-21 21-21 31-21 41-12
11-31 21-31 31-31 41-13
11-41 21-41 31-41 41-14
11-51 21-51 31-51 41-15

Best Answer

a = [2743.727 2743.727 2743.727 2743.727];
b = [2304.763 2304.763 2402.288 2304.764 2304.764];
c = a - b.'
c = 5×4
438.9640 438.9640 438.9640 438.9640 438.9640 438.9640 438.9640 438.9640 341.4390 341.4390 341.4390 341.4390 438.9630 438.9630 438.9630 438.9630 438.9630 438.9630 438.9630 438.9630