atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers...

119
Matlab Course Lecture time: Sunday Off Monday 8:00-10:00 12:00-2:00 Tuesday 14:00-16:00 Wednesday 10:00-12:00 14:00 - 16:00 Thursday 8:00 - 10:00 Location: Albiruni I\II Lab-B Building Thaer Khatib, Palestine Polytechnic University © 1

Transcript of atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers...

Page 1: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

Matlab Course

Lecture time: Sunday Off

Monday 8:00-10:00 12:00-2:00

Tuesday 14:00-16:00

Wednesday 10:00-12:00 14:00 - 16:00

Thursday 8:00 - 10:00

Location: Albiruni I\II Lab-B Building

Thaer Khatib, Palestine Polytechnic University © 1

Page 2: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

Note: The Matlab Software Would be on the Desktop in a file named Matlab _R2008A

For Homework's and any other information

[email protected]

Name| Section| HW#

Thaer Khatib, Palestine Polytechnic University © 2

Page 3: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

Matlab (matrix laboratory)

high-performance language for technical computing integrates

computation, visualization, and programming in an easy-to-use

environment where problems and solutions are expressed in

familiar mathematical notation.

Developed by MathWorks.

Thaer Khatib, Palestine Polytechnic University © 3

Page 4: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

Matlab (matrix laboratory)

Typical uses for Matlab

Math and computation

Algorithm development

Data acquisition

Modeling, simulation, and prototyping

Data analysis, exploration, and visualization

Scientific and engineering graphics

Application development, including graphical user interface building

Thaer Khatib, Palestine Polytechnic University © 4

Page 5: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

Installation Procedure

Thaer Khatib, Palestine Polytechnic University © 5

Page 6: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

6 Thaer Khatib, Palestine Polytechnic University ©

Installation Procedure

Page 7: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

7 Thaer Khatib, Palestine Polytechnic University ©

Installation Procedure

11111-11111-11111-02626

Page 8: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

8 Thaer Khatib, Palestine Polytechnic University ©

Installation Procedure

Page 9: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

9 Thaer Khatib, Palestine Polytechnic University ©

Installation Procedure

Page 10: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

10 Thaer Khatib, Palestine Polytechnic University ©

Installation Procedure

Page 11: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

11 Thaer Khatib, Palestine Polytechnic University ©

Installation Procedure

Page 12: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

12 Thaer Khatib, Palestine Polytechnic University ©

Installation Procedure

license_standalone.dat

Page 13: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

13 Thaer Khatib, Palestine Polytechnic University ©

Installation Procedure

Page 14: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

14 Thaer Khatib, Palestine Polytechnic University ©

The Matlab environment

Command Window

Changing current directory

Prompt\Command line

Files and directories Inside the current directory

Command History

Page 15: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

15 Thaer Khatib, Palestine Polytechnic University ©

Matlab can be used as calculator

Page 16: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

16 Thaer Khatib, Palestine Polytechnic University ©

Our first command

Writing a command in the command line

Page 17: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

17 Thaer Khatib, Palestine Polytechnic University ©

Our first Scrip M-File

Page 18: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

18 Thaer Khatib, Palestine Polytechnic University ©

Making errors …

Page 19: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

19 Thaer Khatib, Palestine Polytechnic University ©

Example

Write a script:

University name

Your name and ID #

Specialization-department-college

Formal email

Page 20: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

20 Thaer Khatib, Palestine Polytechnic University ©

Identifiers

Page 21: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

21 Thaer Khatib, Palestine Polytechnic University ©

Identifiers

Page 22: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

22 Thaer Khatib, Palestine Polytechnic University ©

Reserved words (Keywords)

Page 23: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

23 Thaer Khatib, Palestine Polytechnic University ©

Reserved words (Keywords)

Special Variables pi, eps, ….

realmax, realmin, sin, cos, ….

sqrt(i), rem(i,j),…

Page 24: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

24 Thaer Khatib, Palestine Polytechnic University ©

Constants

Page 25: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

25 Thaer Khatib, Palestine Polytechnic University ©

Variables

Page 26: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

26 Thaer Khatib, Palestine Polytechnic University ©

Variables (cont.)

Page 27: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

27 Thaer Khatib, Palestine Polytechnic University ©

Variables (cont.)

Page 28: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

28 Thaer Khatib, Palestine Polytechnic University ©

Variables (cont.)

Page 29: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

29 Thaer Khatib, Palestine Polytechnic University ©

Operations on variables

Page 30: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

30 Thaer Khatib, Palestine Polytechnic University ©

List of variables

• Who

Page 31: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

31 Thaer Khatib, Palestine Polytechnic University ©

Array is the main data structure

used in Matlab

Page 32: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

32 Thaer Khatib, Palestine Polytechnic University ©

Examples of 1D and 2D arrays

Page 33: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

33 Thaer Khatib, Palestine Polytechnic University ©

Creating 1D Arrays

Page 34: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

34 Thaer Khatib, Palestine Polytechnic University ©

Creating 1D Arrays

Page 35: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

35 Thaer Khatib, Palestine Polytechnic University ©

Creating 1D Arrays

Page 36: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

36 Thaer Khatib, Palestine Polytechnic University ©

Creating 1D Arrays

Page 37: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

37 Thaer Khatib, Palestine Polytechnic University ©

Creating 1D Arrays

Page 38: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

38 Thaer Khatib, Palestine Polytechnic University ©

Creating 1D Arrays

Page 39: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

39 Thaer Khatib, Palestine Polytechnic University ©

Indexing 1D Arrays

Page 40: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

40 Thaer Khatib, Palestine Polytechnic University ©

Indexing 1D Arrays

Page 41: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

41 Thaer Khatib, Palestine Polytechnic University ©

Indexing 1D Arrays

Page 42: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

42 Thaer Khatib, Palestine Polytechnic University ©

Indexing 1D Arrays

Page 43: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

43 Thaer Khatib, Palestine Polytechnic University ©

Indexing 1D Arrays

Page 44: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

44 Thaer Khatib, Palestine Polytechnic University ©

Indexing 1D Arrays

Page 45: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

45 Thaer Khatib, Palestine Polytechnic University ©

Use indexing to edit 1D Arrays

Page 46: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

46 Thaer Khatib, Palestine Polytechnic University ©

Use indexing to edit 1D Arrays

Page 47: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

47 Thaer Khatib, Palestine Polytechnic University ©

1D Array Orientation

Note: difference btw (’) and (.’)

Page 48: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

48 Thaer Khatib, Palestine Polytechnic University ©

Page 49: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

49 Thaer Khatib, Palestine Polytechnic University ©

Reminder of previous lecture

• Introduction.

• Matlab installation.

• Matlab interface.

• Identifiers.

• Arrays.

• Indexing.

• Simple operations on arrays.

Page 50: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

50 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on 1D arrays

Page 51: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

51 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on 1D arrays

Page 52: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

52 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on 1D arrays

Page 53: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

53 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on 1D arrays

Page 54: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

54 Thaer Khatib, Palestine Polytechnic University ©

Sub-array searching

Page 55: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

55 Thaer Khatib, Palestine Polytechnic University ©

Sub-array searching

Page 56: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

56 Thaer Khatib, Palestine Polytechnic University ©

Sub-array searching

Page 57: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

57 Thaer Khatib, Palestine Polytechnic University ©

Arithmetic operations on 1D arrays

Page 58: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

58 Thaer Khatib, Palestine Polytechnic University ©

Arithmetic operations on 1D arrays

Page 59: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

59 Thaer Khatib, Palestine Polytechnic University ©

Arithmetic operations on 1D arrays

Page 60: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

60 Thaer Khatib, Palestine Polytechnic University ©

Arithmetic operations on 1D arrays

Page 61: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

61 Thaer Khatib, Palestine Polytechnic University ©

Matrices (2D Array)

Page 62: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

62 Thaer Khatib, Palestine Polytechnic University ©

Creating matrices

Page 63: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

63 Thaer Khatib, Palestine Polytechnic University ©

Creating matrices

Page 64: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

64 Thaer Khatib, Palestine Polytechnic University ©

Creating matrices

Page 65: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

65 Thaer Khatib, Palestine Polytechnic University ©

Creating matrices

Page 66: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

66 Thaer Khatib, Palestine Polytechnic University ©

Indexing matrices

Page 67: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

67 Thaer Khatib, Palestine Polytechnic University ©

Indexing matrices

Page 68: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

68 Thaer Khatib, Palestine Polytechnic University ©

Indexing matrices

Page 69: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

69 Thaer Khatib, Palestine Polytechnic University ©

Using indexing to modify matrices

Page 70: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

70 Thaer Khatib, Palestine Polytechnic University ©

Using indexing to modify matrices

Page 71: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

71 Thaer Khatib, Palestine Polytechnic University ©

Using indexing to modify matrices

Page 72: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

72 Thaer Khatib, Palestine Polytechnic University ©

Using indexing to modify matrices

Page 73: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

73 Thaer Khatib, Palestine Polytechnic University ©

Using indexing to modify matrices

Page 74: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

74 Thaer Khatib, Palestine Polytechnic University ©

Using indexing to modify matrices

Page 75: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

75 Thaer Khatib, Palestine Polytechnic University ©

Using indexing to modify matrices

Page 76: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

76 Thaer Khatib, Palestine Polytechnic University ©

Using indexing to modify matrices

Page 77: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

77 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on matrices

Page 78: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

78 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on matrices

Page 79: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

79 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on matrices

Page 80: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

80 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on matrices

Page 81: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

81 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on matrices

Page 82: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

82 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on matrices

Page 83: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

83 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on matrices

Page 84: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

84 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on matrices

Page 85: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

85 Thaer Khatib, Palestine Polytechnic University ©

Simple operations on matrices

Page 86: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

86 Thaer Khatib, Palestine Polytechnic University ©

Page 87: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

87 Thaer Khatib, Palestine Polytechnic University ©

Reminder of previous lecture

• Simple operations on 1D arrays.

• Arithmetic operations on 1D arrays.

• Creating matrices.

• Indexing matrices.

• Simple operations on matrices.

• Arithmetic operations on matrices.

Page 88: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

88 Thaer Khatib, Palestine Polytechnic University ©

Plot command

Page 89: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

89 Thaer Khatib, Palestine Polytechnic University ©

Plot command

Page 90: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

90 Thaer Khatib, Palestine Polytechnic University ©

Page 91: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

91 Thaer Khatib, Palestine Polytechnic University ©

Subplot command

The subplot command allows you to subdivide the graphing window into a grid

of m rows and n columns. The function

splits the figure into an m X n matrix. The variable p identifies the portion of the window

where the next plot will be drawn. For example, if the command

Page 92: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

92 Thaer Khatib, Palestine Polytechnic University ©

Subplot command

Example:

x=0:0.1:2*pi;

subplot(2,2,1);

plot(x,sin(x));

subplot(2,2,2);

plot(x,cos(x));

subplot(2,2,3)

plot(x,exp(-x));

subplot(2,2,4);

plot(x,sqrt(x))

Page 93: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

93 Thaer Khatib, Palestine Polytechnic University ©

Complex numbers

The symbol "i" identifies the imaginary part and has to be typed

immediately after the numerical value of the imaginary part

Page 94: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

94 Thaer Khatib, Palestine Polytechnic University ©

Construct complex data from real and imaginary components

complex(x,y)

Page 95: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

95 Thaer Khatib, Palestine Polytechnic University ©

real(x), imag(x), abs(x)

Page 96: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

96 Thaer Khatib, Palestine Polytechnic University ©

Isreal(x), conj(x)

Determine whether input is real array

Complex conjugate

Page 97: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

97 Thaer Khatib, Palestine Polytechnic University ©

Cart2pol, pol2cart

Page 98: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

98 Thaer Khatib, Palestine Polytechnic University ©

Cart2pol, pol2cart

Page 99: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

99 Thaer Khatib, Palestine Polytechnic University ©

Cart2sph, sph2cart

Transform Cartesian coordinates to spherical

Transform spherical coordinates to Cartesian

cart2sph

sph2cart

Page 100: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

100 Thaer Khatib, Palestine Polytechnic University ©

Cart2sph, sph2cart

Transform Cartesian coordinates to spherical

Transform spherical coordinates to Cartesian

cart2sph

sph2cart

Page 101: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

101 Thaer Khatib, Palestine Polytechnic University ©

ver command

ver:

A header containing:

-The current MATLAB product family version number.

-license number.

-operating system.

-version of Java software for the MATLAB product.

The version numbers for MATLAB and all other installed

MathWorks products.

Page 102: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

102 Thaer Khatib, Palestine Polytechnic University ©

Calculus

The Symbolic Math Toolbox provides functions to do the basic

operations of calculus; differentiation, limits, integration,

summation, and Taylor series expansion.

Differentiation

diff(f)

differentiates f with respect to its symbolic variable (in this case x)

Let’s create a symbolic expression.

Page 103: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

103 Thaer Khatib, Palestine Polytechnic University ©

Calculus

Page 104: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

104 Thaer Khatib, Palestine Polytechnic University ©

Calculus

Limits

The fundamental idea in calculus is to make calculations on functions

as a Variable “gets close to” or approaches a certain value. Recall that

the definition of the derivative is given by a limit

provided this limit exists. The Symbolic Math Toolbox allows you to

compute the limits of functions in a direct manner

Page 105: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

105 Thaer Khatib, Palestine Polytechnic University ©

Calculus

Limits

The fundamental idea in calculus is to make calculations on functions

as a Variable “gets close to” or approaches a certain value. Recall that

the definition of the derivative is given by a limit

provided this limit exists. The Symbolic Math Toolbox allows you to

compute the limits of functions in a direct manner

Page 106: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

106 Thaer Khatib, Palestine Polytechnic University ©

Calculus

Page 107: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

107 Thaer Khatib, Palestine Polytechnic University ©

Calculus

Page 108: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

108 Thaer Khatib, Palestine Polytechnic University ©

Calculus

Integration

Page 109: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

109 Thaer Khatib, Palestine Polytechnic University ©

Calculus

Page 110: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

110 Thaer Khatib, Palestine Polytechnic University ©

Solving Equation

If S is a symbolic expression, solve(S) attempts to find values of

the symbolic variable in S for which S is zero. For example,

Page 111: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

111 Thaer Khatib, Palestine Polytechnic University ©

Solving Equation

This is a symbolic vector whose elements are the two solutions.

If you want to solve for a specific variable, you must specify that

variable as an additional argument. For example, if you want to

solve S for b, use the command

Note that these examples assume equations of the form f(x) = 0. If

you need to solve equations of the form f(x)=q(x) you must use

quoted strings. In particular, the command

Page 112: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

112 Thaer Khatib, Palestine Polytechnic University ©

Several Algebraic Equations

Page 113: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

113 Thaer Khatib, Palestine Polytechnic University ©

Linear algebra

Page 114: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

114 Thaer Khatib, Palestine Polytechnic University ©

Linear algebra

Page 115: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

115 Thaer Khatib, Palestine Polytechnic University ©

Linear algebra

Page 116: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

116 Thaer Khatib, Palestine Polytechnic University ©

Linear algebra

Page 117: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

117 Thaer Khatib, Palestine Polytechnic University ©

Polynomial Roots and Characteristic Polynomial

if p is a row vector containing the coefficients of a polynomial,

roots(p) returns a column vector whose elements are the roots

of the polynomial. If r is a column vector containing the roots

of a polynomial, poly(r) returns a row vector whose elements

are the coefficients of the polynomial.

Page 118: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

118 Thaer Khatib, Palestine Polytechnic University ©

Polynomial Roots and Characteristic Polynomial

Page 119: atlab Course - vgloop.com · -version of Java software for the MATLAB product. The version numbers for MATLAB and all other installed MathWorks products. 102

119 Thaer Khatib, Palestine Polytechnic University ©

Polynomial Roots and Characteristic Polynomial