Write a MATLAB function named MAGUV that takes a 1x3 matrix

Write a MATLAB function named MAG_UV that takes a 1x3 matrix as input and computes two outputs - the magnitude and the unit vector (as a 1x3 matrix).

Solution

% MAG_UV
clc
clear all
x = input(\'enter the 1*3 matrix=\'); %[1 2 3 ];
unit_vector = x/norm(x)
magnitude = sqrt(sumsqr(x))

Write a MATLAB function named MAG_UV that takes a 1x3 matrix as input and computes two outputs - the magnitude and the unit vector (as a 1x3 matrix).Solution% M

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site