how do u make a new value that is the sum of two columns

8 ビュー (過去 30 日間)
Sophia Chen
Sophia Chen 2021 年 1 月 22 日
回答済み: Jan 2021 年 1 月 22 日
So I have a value r which is a variable with two columns of value represent the returns of two stocks.
now I wanna make a new variable that is 0.6 of first stock and 0.4 of second stock
how should I do that

回答 (2 件)

Paul Hoffrichter
Paul Hoffrichter 2021 年 1 月 22 日
A = [1 2 ;3 4; 5 6 ;7 8; 9 10; 11 12; 13 14; 15 16]
A =
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
K>> w = .6*A(:,1) + .4*A(:,2);
w =
1.4000
3.4000
5.4000
7.4000
9.4000
11.4000
13.4000
15.4000

Jan
Jan 2021 年 1 月 22 日
A = [1 2 ;3 4; 5 6 ;7 8; 9 10; 11 12; 13 14; 15 16];
B = A * [0.6; 0.4]

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by