Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

NAME : Ricafrente, Jose Emilio V.

Section: ECE21S3

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 v 1 4  1 , w  7 2 0

For length
Syntax: >>v = [1 4 -1];norm(v)
Output: ans = 4.2426

Syntax: >> w = [7 2 0];norm(w)


Output: ans = 7.2801

m
For distance

er as
Syntax: >> distance=norm(v-w)

co
eH w
Output: distance = 6.4031

o.
For angle rs e
ou urc
Syntax: >> costheta=(dot(v,w))/(norm(v)*norm(w))
Output: costheta = 0.4856
Value of theta
o

Syntax: >>theta= acosd(costheta)


aC s
vi y re

Output: theta = 60.95 degrees

 2  4
  1  2
ed d

2. Determine if v   , and w   are orthogonal. Explain why they are orthogonal or why not.
ar stu

0 3
   
 6   1
is

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


Output: ans = 0
Th

If the dot product is equal to zero it is orthogonal therefore the vector v and w is orthogonal because their dot
product is equal to zero.
sh

B. Let a  3  2 1 , Find a value for k so that the dot product of a with b  k 1 4 is zero. Verify your
result in MATLAB. Enter your solutions and MATLAB output in space provided.
a=[ 3 -2 1] , b = [k 1 4]

a∙ b = (3)(k)+(-2)(1)+(1)(4)
3k – 2 + 4 = 0
This study source was downloaded by 100000833611668 from CourseHero.com on 10-08-2021 04:51:56 GMT -05:00

https://www.coursehero.com/file/77876046/MATLAB-ACTIVITY-6-Ricafrente-2-1doc/
3k + 2 = 0
3k = -2
k = -2/3

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


Output: >> ans = 0

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
Syntax: >> v = [4 2 -3]; dot (v, v)
Output: ans = 29

m
er as
2. v   9 3 1 0 6

co
Syntax: >> v=[-9 3 1 0 6]; dot(v, v)

eH w
Output: >> ans = 127

o.
rs e
ou urc
 1 
 2 
3. v  
o

  5
 
aC s

  3
vi y re

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


Output: >> ans = 39
ed d

Describe and differentiate the dot product of each vector


ar stu

As you can see that the product of all the dot products is a positive integer even the
givens has positive and negative integer. And the 2nd problem has the highest product which is
127 next is the 3rd problem which is 39 and lastly the 1st problem which is 29.
is
Th
sh

This study source was downloaded by 100000833611668 from CourseHero.com on 10-08-2021 04:51:56 GMT -05:00

https://www.coursehero.com/file/77876046/MATLAB-ACTIVITY-6-Ricafrente-2-1doc/
m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re
ed d
ar stu
is
Th
sh

This study source was downloaded by 100000833611668 from CourseHero.com on 10-08-2021 04:51:56 GMT -05:00

https://www.coursehero.com/file/77876046/MATLAB-ACTIVITY-6-Ricafrente-2-1doc/
Powered by TCPDF (www.tcpdf.org)

You might also like