matrix elements scaling

3 次查看(过去 30 天)
ofdma_matlab
ofdma_matlab 2012-1-16
can anybody please tell me how to do scaling elements in matlab ? for example, I have a matrix like a = [1 2 4 5 6 4 9] I want to scale down the 3rd element by 2 that means 4/2 = 2 and last element 9 by 3 so that the new matrix will look like
a = [1 2 2 5 6 4 3]
thanks in advance dude

回答(1 个)

Walter Roberson
Walter Roberson 2012-1-16
a(3) = a(3)/2;
a(7) = a(7)/3;
Or,
a = a ./ [1 1 2 1 1 1 3];

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by