Normalize using first element of vector

2 ビュー (過去 30 日間)
Anaya Kharwadkar
Anaya Kharwadkar 2020 年 10 月 3 日
コメント済み: Ameer Hamza 2020 年 10 月 3 日
I want to normalize the elements of the following vector using the first element. I want the first element of my vector 'stock_market' to be 100 and the other elements of the vector to be normalized according to that value. I used the normalize function:
stock_market = readmatrix('^FTSE.csv' , 'Range' , 'F2:F313')
norm_stock_market = normalize(stock_market , 'scale' , 'first' , '100')
but I am getting an error.
Any help would be appreciated. Thanks!

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 3 日
編集済み: Ameer Hamza 2020 年 10 月 3 日
A = [10 20 15 12];
A_new = A/A(1)*100;
Using normalize()
normalize(A, 'scale', 'first')*100
  2 件のコメント
Anaya Kharwadkar
Anaya Kharwadkar 2020 年 10 月 3 日
This works! Thanks so much
Ameer Hamza
Ameer Hamza 2020 年 10 月 3 日
I am glad to be of help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by