# Thread: matlab help

1. ## matlab help

does anyone know how to calculate the magnitude of a vector in matlab? thanks

2. Originally Posted by saha01
does anyone know how to calculate the magnitude of a vector in matlab? thanks
If its a row vector

Code:
sqrt(x*x')
if a column vector

Code:
sqrt(x'*x)
If you don't want to worry about what sort of vector:

Code:
sqrt(sum(x.^2))
CB