Example
Create a script file with the following code:
v = [1: 2: 20];
sv = v.* v; %the vector with elements
% as square of v's elements
dp = sum(sv); % sum of squares -- the dot product
mag = sqrt(dp); % magnitude
disp('Magnitude:'); disp(mag);
When you run the file, it displays the following result:
Magnitude:
36.4692
No comments:
Post a Comment