matlabIntro12011

# matlabIntro12011 - Introduction to Matlab I for MAP 4103...

This preview shows pages 1–6. Sign up to view the full content.

Introduction to Matlab, I for MAP 4103, Mathematical Modelling I, Spring 2011 Xin Li Department of Mathematics University of Central Florida Matlab is a high level programming language widely used in all areas of applications where scientiﬁc computing plays a role. It is highly interactive and user friendly. In this part of Introduction, we pick up some fundamentals of Matlab that will allow us to use Matlab as an advanced calculator. Here’s a record of some Matlab commands we will try in class. I’d like to encourage you to repeat them when you on your own and explore more of Matlab from here. >> diary lecture1.txt >> 22-44 ans = -22 >> ans+55 ans = 33 >> a=22-44 a = -22 >> b=a+3 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
b = -19 >> pi ans = 3.1416 >> format long >> pi ans = 3.141592653589793 >> format short >> u=[1 2 3 4 5 3 2 1] u = 1 2 3 4 5 3 2 1 >> v=[2 4 2] ??? Error using ==> vertcat CAT arguments dimensions are not consistent. >> v=[1;3;4;5] v = 1 3 4 5 2
>> v=[1 2 3 4 ] v = 1 2 3 4 >> u u = 1 2 3 4 5 3 2 1 >> u’ ans = 1 2 3 4 5 3 2 1 >> M=[2 3 11 444 6; 4 55 3 2 1; 5 4 3 2 1] M = 2 3 11 444 6 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 55 3 2 1 5 4 3 2 1 >> M’ ans = 2 4 5 3 55 4 11 3 3 444 2 2 6 1 1 >> zeros(3) ans = 0 0 0 0 0 0 0 0 0 >> zeros(3,5) ans = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> eye(3) ans = 1 0 0 0 1 0 0 0 1 >> ones(3,4) 4
ans = 1 1 1 1 1 1 1 1 1 1 1 1 >> i=1:100 i = Columns 1 through 12 1 2 3 4 5 6 7 8 9 10 11 12 Columns 13 through 24 13 14 15 16 17 18 19 20 21 22 23 24 Columns 25 through 36 25 26 27 28 29 30 31 32 33 34 35 36 Columns 37 through 48 37 38 39 40 41 42 43 44 45 46 47 48 Columns 49 through 60 49 50 51 52 53 54 55 56 57 58 59 60 Columns 61 through 72 61 62 63 64 65 66 67 68 69 70 71 72 Columns 73 through 84 73 74 75 76 77 78 79 80 81 82 83 84 5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/16/2012 for the course MAD 4103 taught by Professor Li during the Spring '11 term at University of Central Florida.

### Page1 / 14

matlabIntro12011 - Introduction to Matlab I for MAP 4103...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online