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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by