Functions within a matrix

If Matrix A = [2200 805; 1250 780; 2225 1005; 1225 1305; 1500 1825]
The objective is to "Create a 5 b2 matrix assigned to variable B, in which the first row is the differenece in column 1 and 2 in A, and the second column of B is the mean of first and second row of A"
I figured out how to get each individual funciton,
i.e.
A( : , 2 ) - A( : , 1) gives me the difference in a column vector, and
mean(A,2) gives me the mean of respected elements in a column vector, however how do i use this information together to create the 5x2 matrix with these respected functions.

回答 (1 件)

per isakson
per isakson 2020 年 10 月 25 日

0 投票

There are several ways, one of which is cat, Concatenate arrays

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

2020 年 10 月 25 日

回答済み:

2020 年 10 月 25 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by