matlab tut

© All Rights Reserved

1 views

matlab tut

© All Rights Reserved

- UT Dallas Syllabus for math2418.001.08s taught by Paul Stanford (phs031000)
- CS202_LAP2
- C Programming 1D Arrays
- UMAT_ORNEK
- UT Dallas Syllabus for math2418.001.08f taught by (xxx)
- Math 3A Midterm
- Modal Analysis of Rotating Structures
- PTV_Vissim_9_-_what_s_new.pdf
- Sparse Matrices
- Manipulating Multistage Interconnection Networks Using Fundamental Arrangements
- UT Dallas Syllabus for math2418.001.09f taught by Paul Stanford (phs031000)
- An Overview of MATLAB
- Lecture2013.03.05
- Data Structures
- 1521Instructions.pdf
- R_ Determine Duplicate Elements
- 08 Slide tr
- CLASS 12 COMP SCI.doc
- data mine
- mat888

You are on page 1of 3

Table below gives the use of a colon in addressing arrays in a matrix.

Colon use for a matrix

Command

Description

V(:)

Refers to all the elements of the vector V.

V(m:n)

Refers to elements m through n of the vector V.

A(:, n)

Refers to the elements in all the rows of a column n of the matrix A.

A(n, :)

Refers to the elements in all the columns of row n of the matrix A.

A(:, m:n)

Refers to the elements in all the rows between columns m and n of the matrix A.

A(m:n, :)

Refers to the elements in all the columns between rows m and n of the matrix A.

A(m:n, p:q) Refers to the elements in rows m through n and columns p through q of the

matrix A.

Example: from the matrix a, write the commands that gives solution of question below in

command window.

=

[

[1 2

4 1

-i]

+

]

a

[6 2 3 -6 -i]

ii

[ 3 4 8 1-i 1+i]

3i

iii

3

iv

v

vi

Solution:

>> a=[3 1 8 2 6+i;1 2 9 5 7-i;6 4 7 3 5+2i;0 0 0 0 6-4i;1 6 2 4 i];

>> a(:,2)=[1 2 4 1 -i]

>> a(1,:)= [6 2 3 -6 -i]

>> a(3,4) = 3i

>> abs(a(:,5))

>> a(3:4,3:4)

1 of 3 Computer application 2

The symbols for arithmetic operations with scalars are summarized below in Table below.

MATLAB has several different screen output formats for displaying numbers. These formats

can be found by typing the help command: help format in the Command Window. A few of these

formats are shown in Table below.

Command

Description

Example

Fixed-point with 4 decimal digits

>> 351/7

format short

ans = 50.1429

Fixed-point with 14 decimal digits

>> 351/7

format long

ans = 50.14285714285715

Scientific notation with 4 decimal digits >> 351/7

format short e

ans = 5.0143e + 001

Scientific notation with 15 decimal digits >> 351/7

format long e

ans = 5.014285714285715e001

Two

decimal

digits

>> 351/7

format bank

ans = 50.14

Best of 5 digit fixed or floating point

>> 351/7

format short g

ans = 50.143

Best of 15 digit fixed or floating point

>> 351/7

format long g

ans = 50.1428571428571

Put a number in ration form

>> 351/7

format rat

ans = 351/7

Example: Consider the two matrices:

(a) A + B (b) AB

(c) A2

(d) AT (e) B1

(f ) BTAT (g) A2 + B2 AB

(h) Determinant of A, determinant of B and determinant of AB.

2 of 3 Computer application 2

Example: Determine the values of x1, x2, x3, x4 for the following set of linear algebraic

equations:

Function

Description

Round to the nearest integer

round(x)

fix(x)

ceil(x)

floor(x)

rem(x,y)

sign(x,y)

and 0 if x= 0.

3 of 3 Computer application 2

Example

>> round(20/6)

ans = 3

>> fix(13/6)

ans = 2

>> ceil(13/5)

ans = 3

>> floor(10/4)

ans = 3

>> rem(14,3)

ans = 2

>> sign(7)

ans = 1

- UT Dallas Syllabus for math2418.001.08s taught by Paul Stanford (phs031000)Uploaded byUT Dallas Provost's Technology Group
- CS202_LAP2Uploaded byAncient Hermit
- C Programming 1D ArraysUploaded byslspa
- UMAT_ORNEKUploaded byonuralpay
- UT Dallas Syllabus for math2418.001.08f taught by (xxx)Uploaded byUT Dallas Provost's Technology Group
- Math 3A MidtermUploaded bydabang sheng
- Modal Analysis of Rotating StructuresUploaded bymatteo_1234
- PTV_Vissim_9_-_what_s_new.pdfUploaded byGlaub
- Sparse MatricesUploaded bygurusodhii
- Manipulating Multistage Interconnection Networks Using Fundamental ArrangementsUploaded byAnonymous Gl4IRRjzN
- UT Dallas Syllabus for math2418.001.09f taught by Paul Stanford (phs031000)Uploaded byUT Dallas Provost's Technology Group
- An Overview of MATLABUploaded byransantiger
- Lecture2013.03.05Uploaded bypikachu_latias_latios
- Data StructuresUploaded bysivaprasadadiraju
- 1521Instructions.pdfUploaded byAdauto Alves
- R_ Determine Duplicate ElementsUploaded byloshude
- 08 Slide trUploaded byBimbimay Salvacion
- CLASS 12 COMP SCI.docUploaded byvishaljalan
- data mineUploaded bypostscript
- mat888Uploaded byBurican Bogdan Alexandru
- ArraysUploaded byJuzer Shabbir
- lab report.docxUploaded byAiman Iftikhar
- Lecture2013.03.28Uploaded bypikachu_latias_latios
- wubCPPUploaded byminichel
- Graphing CalculatorUploaded byryohazuki76
- Gena Rise 44444444Uploaded byAnonymous MqprQvjEK
- Chapter 04Uploaded byNdivhuho Neosta
- BlablaUploaded byMil
- vlookupUploaded bypetrovicsas
- Classified AdsUploaded bydrrajjp

- [40] Lecture Notes 7 - Repeated GamesUploaded byAnishaKanjani
- revtox.23.2-3.2006Uploaded byArmando Chiclla Salazar
- Functional Skills ReadingUploaded byLivia Viziteu
- Hydraulic and Compressible FlowUploaded byJaya D
- Cast-Iron-Types.pdfUploaded byGeorge_Wabag_2014
- xcmsdbUploaded byeldanidan
- Michael Buble-The Way You Look TonightUploaded byRichelle Sales
- 6RDM 39 Assignment on MIS in Rural DevelopmentUploaded byShashidhar Sharma
- 1. RP and AVO AnalysisUploaded byAiman Zaini
- Perineal Trauma in Primiparous Women With Spontaneous Vaginal Delivery Episiotomy or Second Degree Perineal TearUploaded byJunarto Butar Butar
- 3 MD050 Cancelled Po OutBound Funcational SpecificationsUploaded byMurali
- antennasUploaded byNekr01
- KCLogUploaded byahmet
- Intro to ANSYS NCode DL 14 5 L03 WB DL IntegrationUploaded byPercy Romero Murillo
- AstronautUploaded byDenisa Lavinia Profir
- Operations Management by William j Stevenson (2)Uploaded byJackie Hwang
- Condition Monitoring Essentials CatalogUploaded bySowham Chatterjee
- TMS320C64XXUploaded byaldo_suvi
- SI UNITSUploaded byCy Consular
- peuhmw and abrasion resistance testUploaded byhudi_leksono
- IMM Online TrgUploaded bypsp710
- Product Hierarchy.xlsxUploaded byanshika
- Solvent Extraction of Zn(II),La(III) and Cd(III).Uploaded byTaghreed H Alnoor
- unit lesson plan-groupingUploaded byapi-252532158
- 250W Sodium lampUploaded byCarlos Montesinos
- Senior Welding Inspector Signing Off Handout Appendix 1.pdfUploaded bykatfy1
- MM1-Chap5Uploaded byavinashkustagi
- Penerapan Sistem ERP Di PT. Nestle IndonesiaUploaded byNur Faizah Rakhmawati
- Adil ProfileUploaded byAnonymous oVIAFmi
- Gast 23 Series Oilless ManualUploaded byclangbird210