0 views

Uploaded by safdar lashari

mat

mat

© All Rights Reserved

- Applied Mechanics - Statics
- Corral M.-vector Calculus(2008)
- Vector Calculus Bk1
- 7.2 the Dot Product
- Cam Matlab
- Cs602 Mid Term 1 Www.vu786.Com
- Vect Algebra
- Tensor Notation
- JEE Advanced 2014 Solution Paper I
- FEA. Truss Problem With Solution.
- Statics of Rigid Bodies
- Topi Paper
- Dynamics Notes 1
- 3e. Rigid Bodies
- Lesson4.3Vectors
- 1011SEM2-MA1506
- Ch3_FourTrans&DeltaFns.pdf
- Chapter3(3.1~3.5)
- Chapter 3 Moment and Couples
- Fisika Dasar - Introduction and Vector 1.ppt

You are on page 1of 7

05

OBJECTIVE

i) Become familiar with the vector representation in MATLAB

ii) Become familiar with the matrix representation in MATLAB

iii) Become familiar with the basic operations on vectors and matrices

iv) Analyze the conversion of different coordinate systems.

OVERVIEW:

Since MATLAB is matrix laboratory, it is efficient in performing calculations related

to MATLAB. In fact, we can translate almost all of our problems in MATLAB into

matrix calculations and thus avoiding the conventional FOR or WHILE loops, which

are not recommended in MATLAB.

Run the following command.

>>r = [1 : 2 : 6 , -1 : -2 : -7]

>>r = (3 : 6)

>>r (1 : 2 : 7)

>>r (6 : -2 : 1)

Carefully analyze output of above commands and note down your observations.

TRANSPOSING:

We can convert a row vector into a column vector ( and vice versa ) by a process

called transposing, denoted by ' .

>>c=[1 ; 3 ; sqrt(5) ]

>>w=[1 ; -2 ; 3]

>>t=w+2*c'

>>T=5*w'-2*c

OUTPUT & COMMENTS:

Take transpose of

>>x = [1+3i , 2-2i]

i.e.

>>x'

What is output? Why?

OUTPUT & COMMENTS:

OUTPUT & COMMENTS:

SCALAR PRODUCT:

The scalar produce is defined by multiplying the corresponding elements together and

adding the results to give a single number. Suppose we have the following vectors:

>> v= [20 ; -21 ; -22]

>> w= [2 1 3]

The command for scalar produce is "*". However the vector (or matrix) dimensions

must agree, i.e. 1xn vector can be multiplied with nx1 vector.

Try the following commands and find out output. Write down your comments and

observations.

>> u * v

>> u * w

>> u * w'

>> u * u'

What is the difference between these commands? Dot (A,B) is another command used

to calculate dot produce. Try dot command on some of the above vectors.

There is no mathematical definition for the division of one vector by another.

However, in MATLAB, the operator ./ is defined to give element by element division.

It is therefore defined for vectors of same size and type.

>>a./b

>>a./a

>>c = -2:2

>>a./c

>>c./c

OUTPUT & COMMENTS:

You will have encountered INF and NAN in the output of above commands. Explain

them:

OUTPUT & COMMENTS:

To square each element of a vector we could, for example, do u.*u. however, a neater

way is to use the .^ operator.

>> u.^2

>> u.^4

>> u.*w.^(-2)

OUTPUT & COMMENTS:

VECTOR PRODUCT:

Cross (A,B) is the command used to find cross product or vector product of two

vectors. Find cross product (A x B), where A = 3ux + 4uy +5uz and B = 5ux + 4uy +

3uz. Also find B x A.

OUTPUT & COMMENTS:

SIZE OF A MATRIX:

>> size (A)

>> size (D)

>> size(A')

>> size(D')

SPECIAL MATRICES:

MATLAB provides a number of useful built-in matrices of any desired size.

Try the following matrices and write down function of each of them.

>>P=ones(2,3)

>>Z=zeros(2,3)

>>X=eye(5)

EXTRACTING BITS OF MATRICES:

Following commands are used to extract bits of a matrix. Try each of following

command and write down your observations

>>J(2,3)

>>J(: ,3)

>>J(: ,3:3)

>>J(4, : )

>>J(2:3 , 2:3)

MATRIX PRODUCTS:

The products defined for vectors also work for matrices.

Try the following commands

>>A= [5 7 9 ; 1 -3 -7]

>>B= [-1 2 5 ; 9 0 5]

>>x= [8 ; -4 ; 1]

>>A.*B

>>A*x

>>x*A

Also Try.

>>B= [0 1 ; 3 -2 ; 4 2]

>>C=A*B

>>D=B*A

>>E=B'*A'

CONVERSION OF COORDINATE SYSTEM:

r = ρsinΦ y = rsinθ y = ρsinΦsinθ

z=z z=z z = ρcosΦ

z2 + r2 = ρ2 x2 + y2 = r2 x2 + y2 + z2 = ρ2

tanΦ = r/z tanθ = y/x tanθ = y/x

>>clear

>> p = 1;

>> for i=0:pi/10:2*pi

X(p)=1*cos(i)

p=p+1;

end

>> x=[x;x]

>> p=1;

>> for i=0:pi/10:2*pi

y(p)=1*sin(i)

p=p+1;

end

>> y=[y;y];

>>z=[zeros(1,21);ones(1,21)]

>>surf(x,y,z)

HOMEWORK ASSIGNMENT:

Write down a program which (verify results using MATLAB built-in functions):

Transform Polar of Cylindrical coordinates to Cartesian

Transform Spherical coordinates to Polar or Cylindrical

Transform Cylindrical coordinate

- Applied Mechanics - StaticsUploaded byMubeen
- Corral M.-vector Calculus(2008)Uploaded byMohammad Mofeez Alam
- Vector Calculus Bk1Uploaded byTO Haioceank
- 7.2 the Dot ProductUploaded byGary Hoang
- Cam MatlabUploaded byChava Bravo
- Cs602 Mid Term 1 Www.vu786.ComUploaded byESNA678
- Vect AlgebraUploaded byRiddhima Mukherjee
- Tensor NotationUploaded byBrakenjan
- JEE Advanced 2014 Solution Paper IUploaded byanand
- FEA. Truss Problem With Solution.Uploaded byJo Johnson
- Statics of Rigid BodiesUploaded bypesobucks
- Topi PaperUploaded byapi-3843182
- Dynamics Notes 1Uploaded byNitin Belle
- 3e. Rigid BodiesUploaded byhari tubagus
- Lesson4.3VectorsUploaded byAlgerd Moscosa
- 1011SEM2-MA1506Uploaded byYu Shu Hearn
- Ch3_FourTrans&DeltaFns.pdfUploaded byDarioLampa
- Chapter3(3.1~3.5)Uploaded bysugandirezif
- Chapter 3 Moment and CouplesUploaded byMihir Kumar Mech
- Fisika Dasar - Introduction and Vector 1.pptUploaded byBahtiar Afandi
- class2Uploaded byDaniel Oon Wei Rhen
- Lecture 6- 1pageUploaded byAla'a Abu Haibeh
- mathons.pdfUploaded bysh
- Ch 04111Uploaded byVC Chua Yee Leong
- Mws Gen Sle Bck IntroductionUploaded bysushmax
- Computer Science - SylUploaded bymodiark
- Fulltext StampedUploaded byMarvin Delos Reyes
- lucerogaytan magic numberUploaded byapi-288337394
- ch1Uploaded byChristopher David Levy
- Lesson 2OKUploaded byandrewzay_670173166

- 1417458317Uploaded bysafdar lashari
- 1416902644Uploaded bysafdar lashari
- 181 Ohms LawUploaded bysafdar lashari
- Basic Resume Template.docxUploaded bysafdar lashari
- Win Configure Updated Title "Recommended Settings Updated"Uploaded bydams6797
- PB_EULAUploaded byapi-3831160
- New Text DocumentUploaded bysafdar lashari
- chap23.pdfUploaded bysafdar lashari
- Chap-09-Solutions-Ex-9-4-Method.pdfUploaded bysafdar lashari
- Lab01 matlab installation.docxUploaded bysafdar lashari
- Switchgear & Protection.pdfUploaded byramesh
- (8) Controlled Rectifiers.pdfUploaded bysafdar lashari
- Probtransformer-ErannaUploaded byArun Gopi

- Odd Solutions for Otto Bretscher Linear Algebra with Applications, 5th EditionUploaded byc2915831
- F5 Maths Annual Scheme of Work_2012Uploaded bysarahharun
- EC400 Exam Solution 2012 Micro (2)Uploaded byAvijit Puri
- Chapter 3 Stability of DCSUploaded byAnonymous AFFiZn
- CAE (1)Uploaded bydsd
- asst12aUploaded byjacob_ross6297
- Equivalence Between MATLAb and ScilabUploaded byshadowbraz
- On Triangles With Rational Altitudes, Angle Bisectors Or Medians (1999) by Ralph H. BuchholzUploaded byLeon Petrakovsky
- PresentationUploaded byJose Luis Condori
- Section 8.3Uploaded byxipmanix
- ACA2014 MB-FH Convol PDF (1)Uploaded bytrmpereira
- Fe Am Exam Questions Batch 1Uploaded byFranch Maverick Arellano Lorilla
- ByjU BookletUploaded byRishiraj Nalandi
- MELJUN_CORTES_MATHEMATICS_for_COMPUTINGUploaded byMELJUN CORTES, MBA,MPA
- MAT1341 Midterm SolutionUploaded byKerensa Dalan
- Ramanujan's Harmonic Number ExpansionUploaded byapi-26401608
- Unit2paper2 2013 SolutionsUploaded byDanel
- Test Bank for Calculus for the Life Sciences 1st Edition by SchreiberUploaded bya410896504
- SignalsUploaded byManojSharma
- X-Maths_SQP_2018-19Uploaded byasdf
- Gram-Charlier para aproximar densidadesUploaded byAlejandro Lopez
- Calculus Cheat Sheet AllUploaded byDr Milan Glendza Petrovic Njegos
- gr-10-term-1-2019-maths-resource-pack.pdfUploaded byKhadija Parker
- A Note on Orthogonal Lie Algebras in Dimension 4 Viewed as Current Lie AlgebrasUploaded bycrocoali000
- SET IdentitiesUploaded bySandra Enn Bahinting
- Honors Advanced Calculus and Linear Algebra p10Uploaded bymarchelo_chelo
- lebesgueUploaded bySainath Bharadwaj
- Complex Analytic Methods for Partial Differential EquationsUploaded byYejezkEl Villagarcia Zeky
- ManifoldsUploaded byShlomi Fruchter
- Ma2265 Imp QnsUploaded byjkkp