Matlab Activity (Dot Product & Orthogonal) PDF

Title Matlab Activity (Dot Product & Orthogonal)
Course Fundamentals Of Matlab Programming
Institution Technological Institute of the Philippines
Pages 4
File Size 282 KB
File Type PDF
Total Downloads 48
Total Views 201

Summary

Download Matlab Activity (Dot Product & Orthogonal) PDF


Description

MATLAB ACTIVITY 6 – Dot Product & Orthogonal in MATLAB Enter the MATLAB syntax you used and MATLAB output in the space provided 1. Find the length, distance , angle between MATLAB SYNTAX: Length: >> v = [1,4,-1]; >> w = [7,2,0]; >> length_v = norm(v) >> length_w = norm(w)

Distance: >> d = norm(v-w)

Angle: >> costheta = dot(v,w)/(norm(v)*norm(w)) >> theta = acos(costheta)*180/pi

v= [ 1 4 −1 ] , w=[ 7 2 0 ] MATLAB OUTPUT:

2. Determine if not.

2 v= −1 0 6

4 2 w= 3 −1

[] []

MATLAB SYNTAX:

, and

are orthogonal. Explain why they are orthogonal or why

MATLAB OUTPUT:

>> v = [2;-1;0;6]; >> w = [4;2;3;-1]; >> dot = dot(v,w)

Vectors v and w are orthogonal since their dot product is equal to 0. According to the concept of orthogonal vectors, two vectors are orthogonal if their dot product is exactly 0.

B. Let a=[ 3 −2 1 ] , Find a value for k so that the dot product of a with b=[ k 1 4 ] your result in MATLAB. Enter your solutions and MATLAB output in space provided.

a=[ 3 −2 1 ] ; b=[ k 1 4 ] a ∙ b=0

a1 b1 +a 2 b2 + a3 b 3=0 3 k + (−2 ) (1 ) +( 1 )( 4 )=0

3 k−2+ 4=0 3 k −2 = 3 3 k=

−2 3

is zero. Verify

MATLAB SYNTAX:

MATLAB OUTPUT:

>> a = [3, -2, 1]; >> b = [-2/3, 1, 4]; >> dot = dot(a,b)

C. For each of the following vectors v, compute dot(v,v) in MATLAB. Enter the MATLAB syntax you used and MATLAB output in the space provided.

1.

v=[ 4 2 −3 ]

MATLAB SYNTAX:

MATLAB OUTPUT:

>> v = [4, 2, -3]; >> dot_v = dot(v,v)

2.

v=[ −9 3 1 0 6 ]

MATLAB SYNTAX: >> v = [-9, 3, 1, 0, 6]; >> dot_v2 = dot(v,v)

MATLAB OUTPUT:

1 2 v= −5 −3

[]

3.

MATLAB SYNTAX:

MATLAB OUTPUT:

>> v = [1;2;-5;-3]; >> dot_v3 = dot(v,v)

Describe and differentiate the dot product of each vector: -

Proof:

The dot product of each vector has a value not equal to 0 which means these vectors are not orthogonal. The second vector v has a higher dot product since there are more elements within the vector. We can conclude that higher real numbers and the more elements present within a vector, will result into a higher value of dot product....


Similar Free PDFs