Angle of Vector
Use the matrix operation feature to find the angle θ and vector. The angle can be calculated at one time
which forms the standard vector against the multiple vectors.
Calculation
← | ← | ← | ← |
Calculating vector inner product a• b = a b cos θ
Use the above expression to derive the following expression
| ← | ← |
θ = | a• b | |
← | ← | |
| a b |
FLOWCHART
Title : VECTOR
Start
Entry of number of vectors
Definition of arrays
Vector data entry
K = K + 1
Enter no. of vectors for which angles are calculated.
Arrays defined. matA, matB, matC.
Counter for data entry.
Enter x component and Y component of each vector.
Print " Input NUMBER Input N
N M
{M,2} dim (mat A) {2,1} dim (mat B) {M,1} dim (mat C) For K, 1, M, 1
Print " Input VECTOR Print K
Input X
X | mat A(K,1) | |
Input Y |
| |
Y | mat | A(K,2) |
Y
K ≤ M
N
Entry repeated by no. of vectors.
NEXT |
Print "Input FUNDAMENTAL VECTOR |
Input X |
Entry of standard vector data
Calculation of component of standard vector
Enter x component and Y component of standard vector.
Length component of standard vector (scalar) calculated.
X | mat | B(1,1) |
|
Input Y |
| ||
Y | mat | B(2,1) |
|
√ | (mat | B(1,1)2+mat B(2,1)2) | B |
mat A mat B mat C |
| ||
For I, 1, M, 1 |
| ||
√ | (mat | A(I,1)2+mat A(I,2)2) | A |
Calculation of | Product of matrices A and B |
inner product | calculated. |
|
| I = I + 1 |
| Y | I > M |
|
| |
End |
| N |
|
| Calculation of |
| component of vector | |
| Calculation of angle | |
| and display of angle |
Counter for calculation of angle.
Calculation repeated by no. of vectors.
Length component of vector (scalar) calculated.
Angle calculated and displayed.
Print "θ =
Print θ
Wait
NEXT
End
12