Normalize using first element of vector
4 views (last 30 days)
Show older comments
Anaya Kharwadkar
on 3 Oct 2020
Commented: Ameer Hamza
on 3 Oct 2020
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!
0 Comments
Accepted Answer
Ameer Hamza
on 3 Oct 2020
Edited: Ameer Hamza
on 3 Oct 2020
A = [10 20 15 12];
A_new = A/A(1)*100;
Using normalize()
normalize(A, 'scale', 'first')*100
2 Comments
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!