Z = immultiply(X,Y)
multiplies each element in array X by the corresponding element
in array Y and returns the product in the corresponding element
of the output array Z.

Read a grayscale image into the workspace, then convert the image to uint8.

I = imread('moon.tif');
I16 = uint16(I);

Multiply the image by itself. Note that immultiply converts the class of the image from uint8 to uint16 before performing the multiplication to avoid truncating the results.

If X is numeric, then
Z has the same size and class as
X.

If X is logical, then
Z has the same size and class as
Y.

immultiply computes each element of
Z individually in double-precision floating point.
If X or Y is an integer array,
then elements of Z exceeding the range of the integer
type are truncated, and fractional values are rounded.

Tips

If X and Y are numeric arrays of the
same size and class, then you can use the expression X.*Y
instead of immultiply.

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.