Skip to content
Advertisement

matlab equivalent of dot star in python

I am working on a matlab conversion code. what is equivalent of .* in matlab with python?

JavaScript

where v is numpy array :

JavaScript

In such cases, how will I convert code to python?

Advertisement

Answer

For numpy arrays, just using * will do the element-wise multiplication as in Matlab’s .* Link

you can use,

JavaScript

Note: If you want to use matrices instead of arrays in numpy, you have to use the multiply method.

Advertisement