Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Program 3: Finding the Magnitude of a Vector

Program 3: Finding the Magnitude of a Vector

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);

Simulation Results of Program 3 Implementation (Finding the Magnitude of a Vector)

------------------------------------------------------
          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


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial