find the magnitude of the vector a = (-1+i 7i 3 -2-2i). in matlab

To find the magnitude of a vector in MATLAB, you can use the abs() function, which returns the absolute value of each element in the vector and then compute the square root of the sum of the squares of the resulting absolute values.

Here's how to do it for the given vector a:

main.m
a = [-1+1i; 7i; 3; -2-2i];
magnitude = sqrt(sum(abs(a).^2));
61 chars
3 lines

The output will be a scalar value, which is the magnitude of the vector a.

related categories

gistlibby LogSnag