Register to reply

Matrices and Matlab Problem

by andyintranzit
Tags: matlab, matrices
Share this thread:
May26-06, 06:42 AM
P: 6
Hey guys,

Sorry if this is the wrong forum. Someone bump it across if its not.

This is a question on one of my tests (im doing my first semester of Physics at university) and its got to do with the program Matlab.

We have two vectors u and v. Which of the following gives us the unit vector in the direction of v, starting from u?

a) (v-u)/(u*u')
b) (v-u) * (v - u)
c) (v-u)./mag(v-u)
d) (v-u) / (sqrt(v-u)*(v-u)')

'I understand some basic matrix algebra, but im still pretty spun out about matrices. can someone guide me through this? (a) thanks!
Phys.Org News Partner Science news on
Bees able to spot which flowers offer best rewards before landing
Classic Lewis Carroll character inspires new ecological model
When cooperation counts: Researchers find sperm benefit from grouping together in mice
May26-06, 06:58 AM
P: 6
ok.. i think i can eliminate the middle two because...

for b) you cant multiply two identical vector matrices together? cause they'll be in the same form?

and for c) im pretty sure that mag() isn't a Matlab function at all...
May27-06, 12:35 PM
Sci Advisor
P: 2,751
The answer is d.

No mag() is not a matlab function, perhaps they meant abs() which is a function to return the magnetude of a complex value. In any case sqrt(v-u)*(v-u)') is the correct divisor to normalize it.

BTW you know that for row vectors x and y that x*y' gives the dot product of x and y, right? If you happen to be using column vectors then it's just the simple modification of using x'*y of course.

Register to reply

Related Discussions
Block diagonal matrices in MATLAB? Math & Science Software 28
Matrices in matlab Math & Science Software 2
Matrices problem Linear & Abstract Algebra 2
Matrices in Matlab Math & Science Software 5
Eigenvalues of Positive Definite matrices - &MATLAB.. Math & Science Software 3