How can I solve 6 unknowns and 6 equations for power system?

2 views (last 30 days)
below is the code having error in matlab:
function F =power(z)
v1 = 1;
d1=0;
d2=z(1);
d3=z(2);
v2=0.95;
P1=z(3);
Q1=z(4);
Q2=z(5);
Q=z(6);
v3=1.05;
F(1,1)=-9.5*sin(d2) - 10.5*sin(d3)-P1;
F(2,1)=9.5*sin(d2)+9.975*sin(d2-d3)-P1;
F(3,1)= 10.5*sin(d3)+9.975*sin(d3-d2)+0.9;
F(4,1)=9.5*cos(d2)+10.5*cos(d3)-20-Q1;
F(5,1)=9.5*cos(d2)+9.975*cos(d2-d3)-18.05-Q2;
F(6,1)=10.5*cos(d3)+9.975*cos(d3-d2)+22.486-Q;
clear all
z0=fsolve(@power,[0 0 0 0 0 0],optimset('Display','iter'))
error:
Error using .^
Not enough input arguments.

Answers (1)

Walter Roberson
Walter Roberson on 13 Nov 2019
power is the formal name of the .^ operator. The function named power that you are creating is not on your search path. When you tried to create that function named power the command window should have warned you
Warning: Function power has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.
> In rmiml.hasReqDataFile
In rmiml.visibleInToolstrip
In matlab.desktop.editor.JavaEditorDocument>openUsingOpenFileInAppropriateEditor (line 477)
In matlab.desktop.editor.JavaEditorDocument>@(file)openUsingOpenFileInAppropriateEditor(file) (line 76)
In matlab.desktop.editor.JavaEditorDocument>openEditorViaFunction (line 493)
In matlab.desktop.editor/JavaEditorDocument/openEditor (line 76)
In matlab.desktop.editor/DocumentUtils/openEditor (line 28)
In matlab.desktop.editor/Document/openEditor (line 253)
In edit>openEditor (line 250)
In edit>showEmptyFile (line 132)
In edit (line 54)
I suspect that power is being resolved as an object function of the double class. Object functions have priority over functions in the current directory.
In other words: you need to rename your function.
  5 Comments
Walter Roberson
Walter Roberson on 13 Nov 2019
Edited: Walter Roberson on 13 Nov 2019
Using Maple, I can find closed form solutions in terms of the root of a polynomial of degree 6. The solutions are periodic with 6 degrees of freedom (that is, at 6 different locations, adding 2*pi times an arbitrary integer leaves you with another solution.) The polynomial of degree 6 cannot be factored, but it has 6 real roots.
In the below, let R be the roots of the degree 6 polynomial, and let V1, V2, V3, V4, V5, V6 be arbitrary integers. Then,
z1 = arctan(-3/190*R-9/190,-52/110435315*R^5+1382/110435315*R^4+193332/110435315*R^3-5556818/110435315*R^2-39954729/110435315*R+78719/190570)+2*Pi*V5
z2 = arctan(1/70*R,2084/12321855*R^5+10342/4107285*R^4-2243086/4107285*R^3-11746876/2464371*R^2+44087201/12321855*R+333396481/8214570)+2*Pi*V6
z3 = 9/20
z4 = 19/2*cos(arctan(-3/190*R-9/190,-52/110435315*R^5+1382/110435315*R^4+193332/110435315*R^3-5556818/110435315*R^2-39954729/110435315*R+78719/190570)+2*Pi*V5)+21/2*cos(arctan(1/70*R,2084/12321855*R^5+10342/4107285*R^4-2243086/4107285*R^3-11746876/2464371*R^2+44087201/12321855*R+333396481/8214570)+2*Pi*V6)-20
z5 = 19/2*cos(arctan(-3/190*R-9/190,-52/110435315*R^5+1382/110435315*R^4+193332/110435315*R^3-5556818/110435315*R^2-39954729/110435315*R+78719/190570)+2*Pi*V5)+399/40*cos(arctan(-3/190*R-9/190,-52/110435315*R^5+1382/110435315*R^4+193332/110435315*R^3-5556818/110435315*R^2-39954729/110435315*R+78719/190570)-arctan(1/70*R,2084/12321855*R^5+10342/4107285*R^4-2243086/4107285*R^3-11746876/2464371*R^2+44087201/12321855*R+333396481/8214570)+(2*_Z5-2*V6)*Pi)-361/20
z6 = 21/2*cos(arctan(1/70*R,2084/12321855*R^5+10342/4107285*R^4-2243086/4107285*R^3-11746876/2464371*R^2+44087201/12321855*R+333396481/8214570)+2*Pi*V6)+399/40*cos(arctan(-3/190*R-9/190,-52/110435315*R^5+1382/110435315*R^4+193332/110435315*R^3-5556818/110435315*R^2-39954729/110435315*R+78719/190570)-arctan(1/70*R,2084/12321855*R^5+10342/4107285*R^4-2243086/4107285*R^3-11746876/2464371*R^2+44087201/12321855*R+333396481/8214570)+(2*V5-2*V6)*Pi)+11243/500
and
R = RootOf(16*Z^6 + 288*Z^5 - 50928*Z^4 - 611776*Z^3 - 1047932*Z^2 + 4992972*Z + 12089529, Z)
which is to say the set of values, Z, such that the polynomial in Z becomes 0. The solutions are approximately
R = [-60.48923372170306, -8.328809008541537, -3.166479395544543, -3.050016926501990, 2.866879404430057, 54.16765964786107]

Sign in to comment.

Categories

Find more on Polynomials in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!