Doing vectorization in the MATLAB
Hi friends
How do i do vectorization in the MATLAB?
How do i import MATLAB graphics into my Framemaker?
Thanks
Hi friends
How do i do vectorization in the MATLAB?
How do i import MATLAB graphics into my Framemaker?
Thanks
Manipulation of vectors in Matlab is very easy because its language was designed in Linear Algebra Notation. The first thing when you start Matlab is to enter your commands, vectors are so common is Matlab commands and are defined by placing a sequence of numbers within square braces, for example: v = [3 1] and in case you want to print the vector v, all you need is to type its name.
Vectorization is the manner of altering scalar-oriented, loop-based code to use MATLAB vector and matrix operations. MATLAB is optimized for processes concerning vectors and matrices. There are numerous reasons why it is useful to vectorize your code:
Below is an example of a code that calculates the sine of 1,001 values ranging from 0 – 10.
This is the standard code that contains loops and has not been vectorized yet.
Applying vectorization to the code above will result to this:
t = 0:.01:10;
y = sin(t);
The second code normally runs faster compared to the first one.
This is a more effective use of MATLAB.