Title | Lab 1 Math 152 - matlab |
---|---|
Author | Anonymous User |
Course | Linear Systems |
Institution | The University of British Columbia |
Pages | 2 |
File Size | 50.2 KB |
File Type | |
Total Downloads | 57 |
Total Views | 128 |
matlab...
Arpan Grover Student number: 76557172 Lab section: L2B Instructor: Ozgur Yilmaz
Q2. (a) >> (1/3)*(A/2 + 2*B) ans =
Q1. (a)
2.0000 1.5000 -0.5000
>> X = 1.5:-0.5:-1
(b)
X=
>> C = [1 0 1; 0 1 0; 1 0 1]
Columns 1 through 5 1.5000 1.0000 0.5000
C= 0 -0.5000
1
0
1
Column 6
0
1
0
-1.0000
1
0
1
(b) >> Y = [2017 1 3; -5 100 4; 0 -2.5 23]
>> D = [0 1 0; 1 9 2; 1 1 1]
Y=
D=
1.0e+03 *
0
1
0
2.0170 0.0010 0.0030
1
9
2
-0.0050 0.1000 0.0040
1
1
1
0 -0.0025 0.0230 (c)
>> (3*C - 4*D)/5 ans =
>> A = [1 2 3]
0.6000 -0.8000 0.6000
A=
-0.8000 -6.6000 -1.6000
1
2
3
>> B = [4 5 6] B= 4
5
6
>> [A;B] ans = 1
2
3
4
5
6
-0.2000 -0.8000 -0.2000
Q3. (a)
Q4. (a)
>> X = [5 12 0]
>> A = [2 0 1 7]
X=
A=
5 12
0
2
0
1
7
>> sqrt(dot(X,X))
>> B = [-1 9 9 9]
ans =
B=
13
-1
9
9
9
>> norm(X)
>> X = dot(A,B)
ans =
X=
13
70
(b)
>> acos(X/((sqrt(dot(A,A)))*(sqrt(dot(B,B)))))
>> A = [1 -2 -4]
ans =
A=
0.9150
1 -2 -4 >> B = [2 0 1] B= 2
0
1
ans = -2 -9
4
>> dot(cross(A,B),A) ans = 0 >> dot(cross(A,B),B)
0 0.5000 1.0000
sin(X)./cos(X) ans = -0.5463
(c)
0
X= -0.5000
>> cross(A,B)
ans =
(b) X = [-0.5 0 0.5 1 ]
0 0.5463 1.5574...