Problems with entering a angle on matlab

1 次查看(过去 30 天)
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))
R = rad2deg(p)
Angulo = R
Magnitud = r
  3 个评论
Walter Roberson
Walter Roberson 2020-2-3
The complex form of a number with magnitude M and a given number of degrees D, is
theta = deg2rad(D);
z = M .* (cos(theta) + 1i * sin(theta));

请先登录,再进行评论。

回答(1 个)

Roshni Garnayak
Roshni Garnayak 2020-2-11
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)
Angulo = rad2deg(R)
Magnitud = r

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by