r/matlab • u/mytwocts • 13h ago
Absolute square of complex matrix trick.
I often need the absolute square of a complex matrix.
There are several options. I prefer an inline function like abssq(m) ;-).
conj(m).*m,
abs(m).^2m
real(m).^2+imag(m).^2
abssq = @(m) m.''.*m