Problems with entering a angle on matlab

1 Ansicht (letzte 30 Tage)
gabriel Velez
gabriel Velez am 3 Feb. 2020
Beantwortet: Roshni Garnayak am 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))
R = rad2deg(p)
Angulo = R
Magnitud = r
  3 Kommentare
gabriel Velez
gabriel Velez am 3 Feb. 2020
Yes and .3516<-22.02°
Walter Roberson
Walter Roberson am 3 Feb. 2020
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));

Melden Sie sich an, um zu kommentieren.

Antworten (1)

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

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by