Problems with entering a angle on matlab

2 ビュー (過去 30 日間)
gabriel Velez
gabriel Velez 2020 年 2 月 3 日
回答済み: Roshni Garnayak 2020 年 2 月 11 日
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 件のコメント
gabriel Velez
gabriel Velez 2020 年 2 月 3 日
Yes and .3516<-22.02°
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 Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by