The presentation will start after a short

(15 second) video ad from one of our sponsors.

Hot tip: Video ads won’t appear to registered users who are logged in. And it’s free to register and free to log in!

(15 second) video ad from one of our sponsors.

Hot tip: Video ads won’t appear to registered users who are logged in. And it’s free to register and free to log in!

Loading...

PPT – MATLAB CHAPTER 2 Numeric, Cell, and Structure Arrays PowerPoint presentation | free to view - id: 1edc02-ZDc1Z

The Adobe Flash plugin is needed to view this content

View by Category

Presentations

Products
Sold on our sister site CrystalGraphics.com

About This Presentation

Write a Comment

User Comments (0)

Transcript and Presenter's Notes

MATLAB ??CHAPTER 2 Numeric, Cell, and

Structure Arrays

Arrays

- Arrays Collection of numbers
- the basic building block in MATLAB
- addition, subtraction, multiplication, division,

and exponentiation - polynomial algebra and root
- Available classes of arrays in MATLAB 7
- numeric arrays contains only numeric values
- cell arrays access data by its location
- structure arrays access data by name

Arrays

- Cartesian coordinates x, y, and z
- unit vector i, j, k
- express the vector p xi yj zk
- e.g.
- p 5i 7j 2k
- in MATLAB write in a specific order,
- separate with a space,
- identify the group with brackets
- ? 5 7 2
- vector
- row vector 5 7 2
- column vector

Arrays

- Creating Vectors in MATLAB
- MATLAB displays row vectors horizontally and

column vectors vertically. - Create a row vector space or commas separate

elements - g 3 7 9 3,7,9
- Create a column vector semicolon or Enter

separate elements, you can use transpose - g 379 3,7,9 3 (Enter)
- 7 (Enter)
- 9
- Create vectors by appending
- r 2, 4, 20, w 9, -6, 3
- u r, w 2, 4, 20, 9, -6, 3

Arrays

- Creating Vectors in MATLAB
- Generate a large vector of regularly spaced

elements using colon operator () - x mqn
- m the first value
- q the increment (default 1)
- n the last value lt n
- x 028 0, 2, 4, 6, 8 x 027 0,

2, 4, 6 - y -32 -3, -2, -1, 0, 1, 2
- u 10-24 10, 8, 6, 4
- The linspace command, logspace command
- linspace(x1, x2, n) n is number of points

between x1 and x2 - linspace(5,8,31) 50.18
- logspace(a, b, n) n is number of points between

10a and 10b - logspace(-1,1,4) 0.1000, 0.4642, 2.1544,

10.000

Arrays

- Two-Dimensional Arrays
- An array can have multiple rows, multiple

columns, or both - called a matrix
- .
- Creating Matrices
- Space or commas separate elements in different

columns - Semicolons separate elements in different rows
- You can also create a matrix from row or column

vectors - ltexample (a 1,3,5, b7,9,11) gt

Arrays

- Array Addressing
- The row number is always listed first
- The colon operator selects individual elements,

rows, columns, or subarrays of arrays - v( ) represents all the row or column elements

of the vector v. - v(2 5) represents the second through fifth

elements - A( , 3) denotes all the elements in the third

column of the matrix A

C B(23, 13)

The general indexes of two dimensional array

Arrays

- The empty or null array
- contains no elements,
- Rows and columns can be deleted by setting the

selected row or column equal to the null array. - A(3, ) deletes the third row in A
- A(, 24) deletes the second through

fourth columns In A - A(1 4, ) deletes the first and fourth

rows of A - lt Other examples gt

A(1,5) 3

B A(,5-11)

Arrays

- Some Useful Array Functions

Arrays

- Magnitude, Length, and Absolute Value of a Vector
- length the number of elements in the vector.
- magnitude
- absolute value The absolute value of a vector x

is a vector whose elements are the absolute

values of the elements of x. - ltexamplegt
- x 2, -4, 5
- length 3, magnitude 6.7082, absolute value

2, 4, 5 - The Array Editor
- A graphical interface for working with arrays.
- To open the Array Editor from the Workspace

Browser, double-click on the variable you want to

open.

Multidimensional Arrays

- MATLAB supports multidimensional arrays
- The first two dimensions are the row and column,

as with a matrix. - The higher dimensions are called pages.
- ltexamplegt
- Want to create a three dimensional array whose

first page is - and whose second page is
- gtgtA 4, 6, 15, 8, 03, 9, 2
- gtgtA( , , 2) 6, 2, 90, 3, 14, 7, 5

Multidimensional Arrays

- cat command

C cat(3, A, B) produces a three-dimensional

array

ltexamplegt

gtgt A 1 23 4 gtgt B 5 67 8 gtgt C

cat(3, A, B) concatenating the arrays

A, B along the dimension three. C(,,1)

1 2 3 4 C(,,2)

5 6 7 8 gtgt d

size(c) d 2 2 2

Element-by-Element Operations

- Element-by-element operations

Element-by-Element Operations

ltexample1gt

ltexample2gt

gtgtx 00.015 gtgty sin(x2) ??? Error using

gt Matrix must be square. gtgtysin(x.2) gtgtplo

t(x,y)

gtgt x 1 2 3 gtgt y 4 5 6 gtgt x.y ans

1 32 729 gtgty.2 ans 16 25

36 gtgt2.x y ans 2 4 8 16 32 64 cf)

gt 21 2 3 4 5 6 21 22 23 24 25 26

Matrix Operations

- Matrix Multiplication
- Use the operator to perform matrix

multiplication in MATLAB - ltexamplegt
- gtgtA 6, -2,10,34,7
- gtgtB 9,8-5,12
- gtgtAB
- ans
- 64 24
- 75 116
- 1 116
- Special Matrices

Matrix Operations

- Matrix Division
- Right and left operators, / and \
- Chapter 6 covers matrix division and matrix

inverse. - Matrix Exponentiation
- must be a square matrix
- to find A2, type A2
- Special products

Polynomial Operations Using Arrays

- Type help polyfun for more information
- We will use following notation
- Polynomial Addition and Subtrction
- add the arrays that describe their coefficients
- if the polynomials are of different degrees, add

zeros to the coefficient array of the

leower-degree polynomial. - ltexamplegt
- coefficient array is f9, -5, 3, 7 and g 6,

-1, 2 - g 0 g 0, 6, -1, 2
- h fg 9, 1, 2, 9

Polynomial Operations Using Arrays

- Polynomial Multiplication and Division
- Multiply polynomials use conv function (it

stands for convolve) - synthetic division use deconv function (it

stands for deconvolve) - Polynomial functions

gtgtf 9, -5, 3, 7 gtgtg 6, -1, 2 gtgtproduct

conv(f, g) product 54 -39 41 29

-1 14 gtgtquotient, remainder

deconv(f,g) quotient 1.5 -0.5833

remainder 0 0 -0.5833 8.1667

Polynomial Operations Using Arrays

- Plotting Polynomials
- The polyval(a,x) function is very useful for

poltting polynomials. - ltexamplegt
- plot the polynomial

Cell Arrays

- Cell array an array in which each element is a

bin, or cell which can contain an array. - examples
- B 2, 4, 6,-93, 5 72, 10
- H 2, 4, 8, 6, -8, 3 26, 9, 2, 5

1, 4, 5, 7, 5, 2 - J H1, 1 H1, 2 H(2, 2

Cell Arrays

- Cell array functions

Cell Arrays

- Cell Array Function Examples

Structure Arrays

- Structure arrays composed of structures.
- enables you to store dissimilar arrays together
- accessed using namefields
- Creating Structures
- using assignment statements
- using the struct function
- dot notation (.) to specify and to access the

fields - ltexamplegt

student.name John Smith student.SSN

392-77-1786 student.email smithj_at_myschool.ed

u student.tests 67, 75, 84 student(2).name

Mary Jones student(2).SSN

431-56-9832 student(2).email

jonsm_at_myschool.edu student(2).tests 84, 78,

93

Structure Arrays

- Structure functions

Structure Arrays

- Structure Function Examples

About PowerShow.com

PowerShow.com is a leading presentation/slideshow sharing website. Whether your application is business, how-to, education, medicine, school, church, sales, marketing, online training or just for fun, PowerShow.com is a great resource. And, best of all, most of its cool features are free and easy to use.

You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

Recommended

«

/ »

Page of

«

/ »

Promoted Presentations

Related Presentations

Page of

Home About Us Terms and Conditions Privacy Policy Presentation Removal Request Contact Us Send Us Feedback

Copyright 2018 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

Copyright 2018 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

The PowerPoint PPT presentation: "MATLAB CHAPTER 2 Numeric, Cell, and Structure Arrays" is the property of its rightful owner.

Do you have PowerPoint slides to share? If so, share your PPT presentation slides online with PowerShow.com. It's FREE!