11.07.2015 Views

Introduction to MATLAB.

Introduction to MATLAB.

Introduction to MATLAB.

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Numerische Methoden 1, WS 11/12 – B.J.P. KausVec<strong>to</strong>r-vec<strong>to</strong>r multiplication:⎛bb T = ( 5 10 17 ) ⎝51017⎞⎠ = ( 414 )Matrix-matrix multiplication:D T D =( 1 4 52 3 6) ⎛ ⎝ 1 24 35 6⎞⎠ =( 42 4444 49)In numerical modeling, we frequently end up with linear system of equations of the form:Ac = Rhswhere A is a n × m matrix and Rhs is a n × 1 vec<strong>to</strong>r who’s coefficients are both known, and c is a m × 1vec<strong>to</strong>r with unknown coefficients. If we take A = D and Rhs = b T , c is (check!):( ) 1c =21.3 Exploring <strong>MATLAB</strong><strong>MATLAB</strong> is a vec<strong>to</strong>r based computer language, which is available for Windows, MAC, Unix and Linux.It comes with it’s own programming language, which is a bit slow but still extremely useful due <strong>to</strong> it’ssimplicity.1.3.1 Getting startedTo start the program on the ZDV windows machines, make sure that matlab is installed locally (usingZDV Apps) and start matlab by clicking the icons. The <strong>MATLAB</strong> command window starts.1. Type 2+3. You’ll get the answer. Type 2 + 3*9 + 5ˆ2.2. Type>>x=3>>y=x.ˆ2>>z=x*y>>pi>>a=x*pi3. Type demo and explore some examples.4. Type help. You see a list of all help functions. Type help log10 <strong>to</strong> get information about thelog10 command.1.3.2 Vec<strong>to</strong>rs/arrays and plotting5. Create an array of x-coordinates>>dx=2>>x=[0:dx:10]6. Y-coordinates as a function of x>>y=x.ˆ2 + exp(x/2)2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!