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

>> 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일

1 개 추천

Hi,
the dot means an elementwise operation. See here:
For more information to this topic see:
Best regards
Stephan

댓글 수: 3

Matlaber
Matlaber 2019년 3월 12일
What is the simple meaning of elementwise?
elementwise (not comparable) (mathematics) Obtained by operating on one element (of a matrix etc) at a time.
I cannot see the different between "./" and "/".
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

댓글을 달려면 로그인하십시오.

Abdulmanan Butt
Abdulmanan Butt 2019년 3월 13일
편집: Abdulmanan Butt 2019년 3월 13일

0 개 추천

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

Thanks.
If I didn't include ".", it give the same result too
>> 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
> X = X/max(max(X));
>> X
X =
0.2500 0.5000 0.7500 1.0000
Abdulmanan Butt
Abdulmanan Butt 2019년 3월 13일
편집: Abdulmanan Butt 2019년 3월 13일
Ok i got your point. Thats the only when we have one element in second matrix . Lets take an example,
X= [1 2 3 4]
Y=[1 2 3 4]
If we include "." we got answer [1 1 1 1]
and we dont include that dot, wwe will get answer 1.
Actually when we include ".", we will get bit to bit division, menas 1st element of one matrix will be divided by 1st element of second matrix
Kindly have a look on attachment.
Got the point ?
Matlaber
Matlaber 2019년 3월 13일
Thanks. I got it.
"." means element by element, usually one by one
Thanks for your reply.
Abdulmanan Butt
Abdulmanan Butt 2019년 3월 13일
Yes..!!
Welcome.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2019년 3월 12일

댓글:

2019년 3월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by