Example of vectorizing, MATLAB in Statistics

Example of Vectorizing:

Likewise, for an operation on a matrix, a nested loop would be needed; for illustration, supposing a matrix variable mat:

[r c] = size(mat);

for row = 1:r

for col = 1:c

% do something with mat(row,col)

end

end

typically in MATLAB, this is not essential. The Numerical operations can be completed on whole vectors or matrices. For illustration, let's say that we want to multiply each and every element of a vector v by 3, and store the outcome back in v, here v is initialized as shown below:

>> v = [3 7 2 1];

Posted Date: 10/19/2012 3:53:58 AM | Location : United States







Related Discussions:- Example of vectorizing, Assignment Help, Ask Question on Example of vectorizing, Get Answer, Expert's Help, Example of vectorizing Discussions

Write discussion on Example of vectorizing
Your posts are moderated
Related Questions
Example of Functions which complete a task: For illustration, the function below just prints the number arguments passed to it in a sentence format: As this function i

Debugging Techniques: Any error in the computer program is called a bug. This word is thought to date back to the 1940s, whenever a problem with an early computer was found to

Steps for input output functions - Lower level file: The steps involved are as shown below:  Open the file.  Read the file, write to the file, or append to the file.

Illustration of tracing a error: The one way of following the flow of function, or tracing it, is to use the echo function. The echo function, that is a toggle, will show each

Curve Fitting: The data is fundamentally either discrete or continuous. In most of the applications, data is sampled, for illustration, The temperature recorded every ho

#qYou will need to examine two of the nine sections of data: one section of qualitative data (choose either Gender or Position) one section of quantitative data (choose either Intr

Illustration of Nested loops: Running the script shows the output: >> printstars ***** ***** ***** The variable rows identifies the number of rows to print, and

Statistics There are numerous statistical analyses which can be executed on data sets. In MATLAB software, the statistical functions are in the data analysis help topic known a

Operation on file: We concentrate first on the fgetl function that reads strings from the file one line at a time. The fgetl functions afford more control over how the data is

fscanf function - file function: The fscanf reads matrix variable mat columnwise from the file specified by fid. The 'format' involves conversion characters much similar to th