# Problems with entering a angle on matlab

1 view (last 30 days)
gabriel Velez on 3 Feb 2020
Answered: Roshni Garnayak on 11 Feb 2020
I need to enter a angle in a vector to multiply it by a matrix. But i cant enter the angle. when i try to conver from polar to rectangular the answer of the matrix is wrong. This is the code that i wrote.
clear
a = [ -j*32.48, j*10, 0, j*10, 0; j*10, -j*35.52, 0, j*10, j*10; 0, 0, -j*28, j*10, j*10;
j*10, j*10, j*10, 2.917 + -1i*31.217, 0; 0, j*10, j*10, 0, 1.363 + -j*20.369];
a/5;
inv(ans)
%.2001<-13.47
% .3516< -22.02 this two are the angles that i need to put in b.
b = [ 0,.2001, 0, 0, .3516]
c = b * ans
r = abs(c)
p = atan2(imag(c),real(c))
Angulo = R
Magnitud = r
Walter Roberson on 3 Feb 2020
The complex form of a number with magnitude M and a given number of degrees D, is
z = M .* (cos(theta) + 1i * sin(theta));

Roshni Garnayak on 11 Feb 2020
While computing b in your code, you have not considered the phase angles. So to obtain the desired results you can refer to the following piece of code:
clear
a = [ -1i*32.48, 1i*10, 0,1i*10, 0; 1i*10, -1i*35.52, 0, 1i*10, 1i*10; 0, 0, -1i*28, 1i*10, 1i*10;
1i*10, 1i*10, 1i*10, 2.917 + -1i*31.217, 0; 0, 1i*10,1i*10, 0, 1.363 + -1i*20.369];
a/5;
inv(ans)
%.2001<-13.47
% .3516< -22.02 this two are the angles that i need to put in b.
b_angle = deg2rad([0 -13.47 0 0 -22.02]);
b = [ 0,.2001, 0, 0, .3516].*([cos(b_angle) + 1i*sin(b_angle)]);
c = b * ans
r = abs(c)
R = angle(c)
Magnitud = r