How to get the product multiplication of element matrix with equal size?

How to get the product multiplication of element matrix with equal size? I tray with this, but failed
X=pascal(4);
Y=magic(4);
Z(i,j)=X(i,j)*Y(i,j)

 Accepted Answer

Try
X=pascal(4);
Y=magic(4);
Z=X*Y
Z=X.*Y
returns
Z =
34 34 34 34
69 101 101 69
125 217 219 119
206 396 403 185
Z =
16 2 3 13
5 22 30 32
9 21 36 120
4 56 150 20

More Answers (0)

Community Treasure Hunt

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

Start Hunting!