Download presentation

Presentation is loading. Please wait.

Published byTristan Akers Modified about 1 year ago

1
ENG004 ALGORITHMS & INT. TO PROGRAMMING Week 3 “An introduction to arrays and matrices” Ahmet Anıl Dindar

2
ENG The class facts address: Class web page:

3
ENG Last week What is Algorithm and Programming? Why do we need programs? A powerful tool- MATLAB What is MATLAB? Why MATLAB? How to use it? The first commands in MATLAB.

4
ENG This week Variables Defining a new variable Assigning a value to a variable Variable types An introduction to arrays and matrices Entering arrays and matrices Creating arrays and matrices manually by entering values. Generating arrays and matrices by defining certain rules Generating arrays and matrices by defining certain rules Creating arrays from existing arrays By using built-in matrix generators

5
ENG Variables What is variable? Homer Simpson Are there anyone whose name is Homer Simpson? (probably) YES

6
ENG Variables: Variable is a tag given to a specific matrice, number or anything. You can change the content of the variable any time. You can name a variable with alphabetic or alpha- numeric. The variables are important in programming. A good sense and logic is essential to follow the codes.

7
ENG And now let’s see How it is in MATLAB! Follow me now!

8
ENG >> a=1 a = 1 >> a=1 a = 1 >> a+a ans = 2 Variables in MATLAB (Alphabetic): >> a=1 a = 1 >> a+a ans = 2 >> a*a ans = 1

9
ENG >> a1=10 a1 = 10 >> a1=10 a1 = 10 >> a1 a1 = 10 Variables in MATLAB (Alphanumeric): >> a1=10 a1 = 10 >> a1 a1 = 10 >> a1*(2*a1)/5 ans = 40

10
ENG >> a=10 a = 10 >> a1=5 a1 = 5 >> a+a1 ans = 15 >> a+a1*(a-a1) ans = 35 >> Variables in MATLAB:

11
ENG An introduction to arrays and matrices What is matrice? What is array? What are the matrices we use? What are the calculations? The properties of the matrices? The matrices named with variables?

12
ENG Creating a Matrice >> a=[1 3 4] a = >> a1 = Row Matrix (Vector) Column Matrix (Vector)

13
ENG Creating a Matrice >> ali=[1 2 3;4 5 6;7 8 9] ali = An Ordinary Matrice

14
ENG Generating arrays and matrices by defining certain rules: >> a=(1:10) a = Columns 1 through Columns 8 through Generic Creation (one by one): >> deli=(1:2:10) deli = >> Generic Creation (two by two): >> deli=(10:-2:0) deli = Generic Creation (???):

15
ENG Generating arrays and matrices by defining certain rules: >> ones(1,10) ans = >> zeros(1,5) ans = Some Special Matrices What about a matrice with full of 2’s >> twos(1,5)

16
ENG Generating arrays and matrices by defining certain rules: >> ones(1,10) ans = >> zeros(1,5) ans = Some Special Matrices What about a matrice with full of 2’s >> twos(1,5)

17
ENG Creating matrices from matrices >> a=(1:5) a = >> b=(2:6) b = >> c=[a;b] c = Using matrices to create new matrices

18
ENG Assignment There is not any assignment!

19
ENG Next week... WeeksDateClassAssignment Introduction to the classRegistration Exploring MATLABAssignment Arrays and Matrix Operations N.A Arrays and Matrix Operations Assignment Arrays and Matrix OperationsAssignment Polynomials and curve-fitting Assignment Descriptive statistics Assignment Programming Elements of MATLAB N.A Programming Elements of MATLAB Assignment Programming Elements of MATLAB Assignment Plotting and Animations N.A Plotting and Animations Assignment Numerical Integration Assignment Symbolic Math Assignment Take-home final projectN.A.

20
ENG See you next week!

21
ENG

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google