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

LAB-5

Topic: Vector Calculus LAB Experiment


Reg no: 19BEC7016

Name: B.Vishnu

% 1. Find the distance between two points in 2D and 3D environment


%a). When coordinate of point A is (2,3) and coordinate of point B is (4,6). clc
clear all close all x1=2; x2=4; y1=3; y2=6;
a_distance=sqrt((x2-x1).^2+(y2-y1).^2)

a_distance = 3.6056

%b). When coordinate of point C is (9,8,7) and the coordinate of point D is (5,6,7).
clc clear all close all x1=9; x2=5; y1=8; y2=6; z1=7; z2=7;
b_distance=sqrt((x2-x1).^2+(y2-y1).^2+(z2-z1).^2)

b_distance = 4.4721

% 2. Find the Angle between two vectors in 2D and 3D environment.


% a). When coordinate of point E is (5,7) and coordinate of point F is (8,11). clc
clear all close all
subspace([9;8;7],[3;2;5])

ans = 0.4312

% b). When coordinate of point G is (9,8,7) and the coordinate of point H is


(3,2,5). clc clear all close all
subspace([5:7],[8:11])

ans = 0

%3. Find the Unit vector U in the following direction.


%a). from a point I is (5,7) to the point J is (8,11). clc clear all close all I =
[5 7];
J = [8 11]; Unit = I + J /(norm(I-J))

Unit = 1×2
6.6000 9.2000

%b). vector K = < 3, 8, 3√3 >


clc
clear
all
close
all
K = [3 8 3*3^1/2]
K = 1×3

1
3.0000 8.0000 4.5000

Unit2 = K/norm(K)

Unit2 = 1×3
0.3107 0.8284 0.4660

%4. Find the center and radius of the given sphere x.^2+y.^2+z.^2− 6 + 8 = 0

%5. Find the following using the arithmetic operators.


%Let L= 2 + 7 − 9 and M= 12 + 27 − 29

%a).
L+5M clc
clear
all
L = [2 7 -9]
L = 1×3
2 7 -9

M = [12 27 -29]

M = 1×3
12 27 -29

Z = L+5*M

Z = 1×3
62 142 -154

%b) L x 5M
clc
clear all L
= [2 7 -9]

L = 1×3
2 7 -9

M = [12 27 -29]

M = 1×3
12 27 -29

Y = L.*(5*M)

Y = 1×3
120 945 1305

%c) M/L
clc
clear
all
L = [2 7 -9]
L = 1×3

2
2 7 -9

M = [12 27 -29]

M = 1×3
12 27 -29

X = M/L

X = 3.5373

%d) M-L
clc
clear
all
L = [2 7 -9]
L = 1×3
2 7 -9

M = [12 27 -29]

M = 1×3
12 27 -29

w = M-L

w = 1×3 10
20 -20

%6. Find the following for the given vector = 2 + 5 + 7 %a) Speed.
%b) Direction of the motion

You might also like