Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
clc
clear all
disp('------------------------------------------------------ ');
disp(' MAGNITUDE OF VECTOR Q ');
disp('------------------------------------------------------ ');
disp('Enter values for vector Q ex [1 -1 0]');
Q = input('Enter Q:');
Q_mag = norm(Q); % magnitude of vector Q
fprintf('Magnitude of the difference of two vectors is %f\n',Q_mag);------------------------------------------------------
MAGNITUDE OF VECTOR Q
------------------------------------------------------
Enter values for vector Q ex [1 -1 0]
Enter Q:[2 1 -1]
Magnitude of the difference of two vectors is 2.449490