Can we use sine and cosine on a matrix of any dimension that needed not to be a square matrix?

"

A=rand(2,3)
cos(A) #will create error

"
what is the alternative to this

cos(A) calculates the matrix cosine of A. If you want the cosine of each element, you can use broadcasting with . like this:

A = rand(2,3)
cos.(A)
1 Like