I have a matrix like the following:
A =
5 2 10 14 11
I am looking to create an additional row using this data. The element in the fifth column, second row, is constant and known: 100
By subtracting from the above row I am looking to insert these values
B =
63 65 75 89 100
E.g. 100-11 = 89. 89-14=75
To ultimately give the following:
[A;B]
ans =
5 2 10 14 11
63 65 75 89 100
Any suggestions?
You can use the cumulative summation of the elements of
A, via the MATLAB functioncumsum, in order to perform this calculation: