To create a new 2 x 2 matrix e
by dividing each element of matrix c
by the corresponding element of matrix d
in MATLAB, you can use elementwise division with the ./
operator. Here's how you can do it:
main.m162 chars7 lines
Output:
main.m14 chars3 lines
In this example, we defined matrix c
as a 2x2 matrix with values [1, 2; 3, 4] and matrix d
as a 2x2 matrix with values [2, 2; 2, 2]. Then, we performed elementwise division on c
and d
using the ./
operator to create the new matrix e
. The result is printed using disp()
function.
gistlibby LogSnag