Presentation is loading. Please wait.

Presentation is loading. Please wait.

MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.

Similar presentations


Presentation on theme: "MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and."— Presentation transcript:

1

2

3 MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and visualization. It integrates numerical analysis, matrix computation, signal processing, and graphics in an easy-to-use environment. MATLAB also features a family of application-specific solutions called toolboxes. Toolboxes are comprehensive collections of MATLAB functions that extend its environment in order to solve particular classes of problems.

4 using Matlab as a numerical calculator entering row vectors and column vectors entering matrices forming matrix and vector products doing matrix products, sums etc using Matlab to solve linear equations Matlab functions that operate on arrays Plotting basic graphs using Matlab.

5 Command Window Workspace window Command History

6 This is the Matlab screen – it broken into 3 parts On the right you have the Command Window – this is where you type commands and usually the answers (or error messages) appear here too On the top left you have the Workspace window – if you define new quantities (called variables) there names should be listed here. On the bottom left you have Command History window – this is where past commands are remembered. If you want to re-run a previous command or to edit it you can drag it from this window to the command window to re-run it.

7

8 - Double clicking on the MATLAB icon that should be on the desktop of your computer. - The Command Window allows a user to enter simple commands. - Next press the Enter or Return key. For instance, >> s = 1 + 2 s = 3 Note that the results are saved in variables whose names are chosen by the user. If they will be needed during your current MATLAB session, then you can obtain their values typing their names and pressing the Enter or Return key. For instance, >> s s = 3 To close MATLAB type exit in the Command Window and next press Enter or Return key. A second way to close your current MATLAB session is to select File in the MATLAB's toolbar and next click on Exit MATLAB option. All unsaved information residing in the MATLAB Workspace will be lost.

9 Enter formulas at the command prompt >> 2 + 6 - 4 (press return after ‘‘4’’) ans = 4 >> ans/2 ans = 2 Matlab as a Calculator (1)

10 Define and use variables >> a = 5 a = 5 >> b = 6 b = 6 >> c = b/a c = 1.2000

11 pi (= π) and ans are a built-in variables >> pi ans = 3.1416 >> sin(ans/4) ans = 0.7071 Note: There is no “degrees” mode. All angles are measured in radians.

12 Many standard mathematical functions, such as sin, cos, log, and log10, are built-in >> log(256) log(x) computes the natural logarithm of x ans = 5.5452 >> log10(256) log10(x) is the base 10 logarithm ans = 2.4082 >> log2(256) log2(x) is the base 2 logarithm ans = 8

13 Results of intermediate steps can be suppressed with semicolons. Example: Assign values to x, y, and z, but only display the value of z in the command window: >> x = 5; >> y = sqrt(59); >> z = log(y) + x^0.25 z = 3.5341

14 Type variable name and omit the semicolon to print the value of a variable (that is already defined) >> x = 5; >> y = sqrt(59); >> z = log(y) + x^0.25 z = 3.5341 >> y y = 7.6811 ( = log(sqrt(59)) + 5^0.25 )

15 Use commas or semicolons to enter more than one statement at once. Commas allow multiple statements per line without suppressing output. >> a = 5; b = sin(a), c = cosh(a) b = -0.9589 c = 74.2099

16 NameMeaning ansvalue of an expression when that expression is not assigned to a variable epsfloating point precision pi, (3.141492...) realmaxlargest positive floating point number realminsmallest positive floating point number Inf∞, a number larger than realmax, the result of evaluating 1/0. NaNnot a number, the result of evaluating 0/0

17 Then the Basic Arithmetic is : + Addition - Subtraction * Multiplication / Division ^ Power ' Complex conjugate transpose

18  The >> is the default command prompt in Matlab  All text after % sign is taken as comment.  A semicolon at the end of the line will prevent MATLAB from echoing the information you type on the screen.  Multiple commands can be placed on the line seperated by commas or semicolons.  Typing who at the prompt will display all variables in the workspace.  Typing clear will remove all variables.  You can stop Matlab execution at any time by pressing Ctrl-C at any time

19 Using matlab to calculate :

20 Commands sin - Sine. cos - Cosine. tan - Tangent. sec - Secant. cot - Cotangent. exp - Exponential log - Natural logarithm. sqrt - Square root.

21 Operators Commands + Plus; addition operator. - Minus; subtraction operator. * Multiplication operator. ^ Exponentiation operator..^ Array exponentiation operator. / division operator. % For comment. = Assignment (replacement) operator.

22 Commands for Managing a Session clc Clears Command window. clear Removes variables from memory. exist Checks for existence of file or variable. help Searches for a help topic. quit Stops MATLAB. who Lists current variables. whos Lists current variables (long display).


Download ppt "MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and."

Similar presentations


Ads by Google