Professional Documents
Culture Documents
MATLAB ACTIVITY 6 Ricafrente 2 1
MATLAB ACTIVITY 6 Ricafrente 2 1
Section: ECE21S3
Enter the MATLAB syntax you used and MATLAB output in the space provided
For length
Syntax: >>v = [1 4 -1];norm(v)
Output: ans = 4.2426
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
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
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
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
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)