MATLAB Data Types & Plotting: Complex Numbers, Strings, Arrays, Plots, Slides of Computer Science

This chapter from the MATLAB textbook covers various data types in MATLAB, including complex numbers, strings, multidimensional arrays, and additional plot types. It explains how to perform arithmetic operations on complex numbers, create and manipulate strings, work with multidimensional arrays, and generate complex, string, and multidimensional plots. It also includes examples and exercises.

Typology: Slides

2020/2021

Uploaded on 12/03/2021

1-63l
1-63l 🇹🇼

5

(1)

13 documents

1 / 79

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 6 Additional Data
Types and plot Types
Chun-Ming Tsai
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f

Partial preview of the text

Download MATLAB Data Types & Plotting: Complex Numbers, Strings, Arrays, Plots and more Slides Computer Science in PDF only on Docsity!

Chapter 6 Additional Data

Types and plot Types

Chun-Ming Tsai

Contents

  • Complex data
  • String functions
  • Multidimensional Arrays
  • Additional Data Types
  • Additional Two-Dimensional Plots
  • Three-Dimensional Plots

6.1 Complex Data

  • Complex numbers are numbers with both a real and an

imaginary component.

P

a + bi

real axis

imaginary axis

b

a

P a + bi

real axis

imaginary axis

z

a

b

z a b

b z

a z

c a bi z

1

2 2

tan

sin

cos

= −

= +

=

=

= + = 

  • If complex numbers c 1 and c 2 are defined as c 1 = a 1 + b 1 i ,

and c 2 = a 2 + b 2 i , then the addition, subtraction, multiplication, and division of c 1 and c 2 are defined as:

i a b

b a a b

a b

a a bb

c

c

c c a a bb a b b a i

c c a a b b i

c c a a b b i

2 2

2 2

1 2 1 2 2 2

2 2

1 2 1 2

2

1

1 2 1 2 1 2 1 2 1 2

1 2 1 2 1 2

1 2 1 2 1 2

  • Using complex numbers with relational

operators

  • It is possible to compare two complex numbers with the == relational operator - To see if they equal to each other.
  • To compare them with the ~= operator
    • To see if they are not equal to each other.
  • However, comparisons with the >, <, >=, or <= operators do not produce the expected results. - Compare with real parts
  • Compare with the magnitudes of c 1 and c

See Table 6.1 (page 266)

  • Example 6.1 The Quadratic Equation

(revisited)

  • Page 270
  • If both the real and imaginary parts of the

function are of interest, then the user has

several choices.

  • Alternatively, the real part of the function

can be plotted versus the imaginary part.