As a part of a longer code, I get a quantity phi1 and phi2 (matrices of size 128x128) which are the arguments of a complex quantity. Now I define the following quantities in MATLAB:
alpha=phi1-phi2;
S1=cos(alpha);
S2=sin(alpha);
K=atan2(S2,S1);
Now, K should be equal to alpha. Therefore, the matrix B defined as:
B=K-alpha;
should be zero.But the result is coming out to be different. Though several elements of B are zero, a lot of them have the value 6.2832 (i.e 2pi). Why this could be happening?