Cartesian to polar matrix

Hello,
There is a matrix ;
Ybus=
x1+y1j x2+y2j x3+y3j x4+y4j
Our code should convert polar form;
Result=
x1angle x2 angle x3 angle x4 angle
Can you help us ,please?

Answers (2)

If Ybus = [x + iy] then
[angle_Ybus, rho_Ybus] = cart2pol(real(Ybus), imag(Ybus));

2 Comments

Ybus = [ 20 -j*50 -10 +j*20 -10 +j*30
-10+j*20 26-j*52 -16+j*32
-10+j*30 -16+j*32 26-j*62];
[angle_Ybus, rho_Ybus] = cart2pol(real(Ybus), imag(Ybus));
D = rad2deg(angle_Ybus)
Result=[rho_Ybus ; D]
>> Result
Result =
53.8516 22.3607 31.6228 -68.1986 116.5651 108.4349
22.3607 58.1378 35.7771 116.5651 -63.4349 116.5651
31.6228 35.7771 67.2309 108.4349 116.5651 -67.2490
But Result Should be ;
>> Result
Result =
53.8516 -68.1986 22.3607 116.5651 31.6228 108.4349
22.3607 116.5651 58.1378 -63.4349 35.7771 116.5651
31.6228 108.4349 35.7771 116.5651 -67.2490 67.2309
It should be [rho angle rho angle rho angle
rho angle rho angle rho angle
rho angle rho angle rho angle]
Thanks for support

Sign in to comment.

Ybus = [ 20-j*50 -10+j*20 -10+j*30
-10+j*20 26-j*52 -16+j*32
-10+j*30 -16+j*32 26-j*62];
[angle_Ybus, rho_Ybus] = cart2pol(real(Ybus), imag(Ybus));
D = rad2deg(angle_Ybus);
% initialize Result with zeros
Result = zeros(size(rho_Ybus, 1), 2*size(rho_Ybus, 2));
% place rho values in alternative column
Result(:,1:2:end) = rho_Ybus;
% place D values in alternative column
Result(:,2:2:end) = D;
% Result is your required matrix

Categories

Asked:

on 23 Nov 2019

Commented:

on 25 Nov 2019

Community Treasure Hunt

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

Start Hunting!