what does "X = X./max(max(X))" means?>

14 次查看(过去 30 天)
Matlaber
Matlaber 2019-3-12
>> X=[1,2,3,4]
X =
1 2 3 4
>> X = X./max(max(X));
>> X
X =
0.2500 0.5000 0.7500 1.0000
>>
I understand from the output, but what does "./" means?

回答(3 个)

Stephan
Stephan 2019-3-12
编辑:Stephan 2019-3-12
Hi,
the dot means an elementwise operation. See here:
For more information to this topic see:
Best regards
Stephan
  3 个评论
Stephan
Stephan 2019-3-12
编辑:Stephan 2019-3-12
try this:
A=magic(3)
b = [2,4,5]
result1 = A/b
result2 = A./b
or
A=magic(3)
b = [1 -2 3; -4 -5 -6; 7 8 -9]
A/b % mrdivide
A./b % rdivide
Read about the both operations:
Matlaber
Matlaber 2019-3-12
thanks!
"./" is element by element, one element by one element

请先登录,再进行评论。


Matlaber
Matlaber 2019-3-12

Abdulmanan Butt
Abdulmanan Butt 2019-3-13
编辑:Abdulmanan Butt 2019-3-13
Hi,
It means,
You are dividing X matrix (element-wise) with the element of matrix X having maximum value.
Like in this case, max(X) or max(max(X)) will be 4, and you are going to divide matrix X with that 4, Where 4 will be divided to each element of matrix X in this element-wise division case, So you got the final result,
X= 0.2500 0.5000 0.7500 1.0000
Regards,
Abdulmanan Butt
  4 个评论
Matlaber
Matlaber 2019-3-13
Thanks. I got it.
"." means element by element, usually one by one
Thanks for your reply.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by