summaryrefslogtreecommitdiff
path: root/1172/CH4/EX4.2.1/Example4_2a.sce
blob: 2318c7107bf2e537d9788d90b95d3b71649f924d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
clc
//Given that
r = [2,2,2*sqrt(2)]

// sample Problem 2a  Page No. 176
printf("\n \n\n # Problem 2a # \n")
r_magnitude = sqrt ( 2^2 + 2^2 + (2*sqrt(2))^2)
cos_x =  ( 2 / r_magnitude)
cos_y = ( 2 / r_magnitude)
cos_z = ( 2.8284 / r_magnitude)
printf(" \n Directional cosine in X - axis is %f ", cos_x)
printf(" \n Directional cosine in Y - axis is %f " ,cos_y)
printf(" \n Directional cosine in Z - axis is %f ", cos_z)