-
8
pages
-
English
-
Documents
Description
AMATH 352 Lecture 3MATLAB TutorialMATLAB (short for MATrix LABoratory) is a very useful piece of software for numericalanalysis. It provides an environment for computation and the visualization. Learning MATLAB isnot the goal of this course, but a working knowledge of MATLAB will allow you to implement andtest the algorithms that form the heart of this course. Seeing these algorithms at work will hopefullyenable a deeper understanding of the mechanics, strengths and pitfalls of each algorithm.Starting MATLABTo start MATLAB, click on the MATLAB icon or type matlab at the command line prompt.To exit, typequit.Entering VariablesThere are three types of variables that you can use in matlab: scalars, vectors and matrices. Toassign a value to a scalar variable, type>> x = 0.2After hitting return, MATLAB will echo the value of the variable back to you:x =0.2000If you don’t want to see the value of the variable, add a semicolon at the end of the line:>> x = 0.2;To enter a vector or matrix, use square brackets to indicate the start and end of the vector/matrix.For example a row vector may be entered:>> y = [ 0 1 2 3 4]y =0 1 2 3 4To enter a variable with more than one row, the rows of the vector or matrix are separated bysemicolons or by carriage returns. For example a column vector may be entered:>> z = [ 0; 1; 2; 3; 4]z =012341A matrix may be entered similarly, with the rows of the matrix separated in this case by carriagereturns and the whole ...
-
Publié par
-
Langue
English