plotting graph for Equation with constraints
3 views (last 30 days)
Show older comments
Hi I would like to plot the graph for my Torque vs flux linkage. (T vs P ) λn = 1 pu, in = 1 pu, and ld = 1.5 pu
T=P.*x+1.5*x.*y
(y.^2)+(x.^2)=1
((x.*y).^2)+(-P).^2=1
i can't seem to set constrain for my equation
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1119905/image.png)
Answers (2)
Torsten
on 8 Sep 2022
Edited: Torsten
on 8 Sep 2022
Use
(y.^2)+(x.^2)=1
((x.*y).^2)+(-P).^2=1
to write x,y as functions of P.
Then insert these expressions in
T = P.*x+1.5*x.*y.
Look which of the below solutions is the correct one for T.
syms P x y
T = P*x+1.5*x*y;
eqn1 = (y^2)+(x^2)==1;
eqn2 = ((x*y)^2)+(-P)^2==1;
s = solve([eqn1 eqn2],[x y]);
Tsubs(1) = subs(T,[x y],[s.x(1),s.y(1)]);
Tsubs(2) = subs(T,[x y],[s.x(2),s.y(2)]);
Tsubs(3) = subs(T,[x y],[s.x(3),s.y(3)]);
Tsubs(4) = subs(T,[x y],[s.x(4),s.y(4)]);
Tsubs(5) = subs(T,[x y],[s.x(5),s.y(5)]);
Tsubs(6) = subs(T,[x y],[s.x(6),s.y(6)]);
Tsubs(7) = subs(T,[x y],[s.x(7),s.y(7)]);
Tsubs(8) = subs(T,[x y],[s.x(8),s.y(8)]);
fun1 = matlabFunction(Tsubs(1));
fun2 = matlabFunction(Tsubs(2));
fun3 = matlabFunction(Tsubs(3));
fun4 = matlabFunction(Tsubs(4));
fun5 = matlabFunction(Tsubs(5));
fun6 = matlabFunction(Tsubs(6));
fun7 = matlabFunction(Tsubs(7));
fun8 = matlabFunction(Tsubs(8));
P = [linspace(-1,-sqrt(3/4)-eps,50),NaN,linspace(sqrt(3/4)+eps,1,50)];
plot(P,[fun1(P);fun2(P);fun3(P);fun4(P);fun5(P);fun6(P);fun7(P);fun8(P)])
0 Comments
Torsten
on 8 Sep 2022
Edited: Torsten
on 8 Sep 2022
Use
(y.^2)+(x.^2)=1
((x.*y).^2)+(-P).^2=1
to write x,y as functions of P.
Then insert these expressions in
T = P.*x+1.5*x.*y.
The result is modern art.
format long
P = [linspace(-1,-sqrt(3/4)-eps,50),NaN,linspace(sqrt(3/4)+eps,1,50)];
x1_sqr = 0.5*(1-sqrt(4*P.^2-3));
y1_sqr = 0.5*(1+sqrt(4*P.^2-3));
x2_sqr = y1_sqr;
y2_sqr = x1_sqr;
x11 = sqrt(x1_sqr);
x12 = -sqrt(x1_sqr);
y11 = sqrt(y1_sqr);
y12 = -sqrt(y1_sqr);
x21 = sqrt(x2_sqr);
x22 = -sqrt(x2_sqr);
y21 = sqrt(y2_sqr);
y22 = -sqrt(y2_sqr);
T11_11 = P.*x11+1.5*x11.*y11;
T11_12 = P.*x11+1.5*x11.*y12;
T12_11 = P.*x12+1.5*x12.*y11;
T12_12 = P.*x12+1.5*x12.*y12;
T21_21 = P.*x21+1.5*x21.*y21;
T21_22 = P.*x21+1.5*x21.*y22;
T22_21 = P.*x22+1.5*x22.*y21;
T22_22 = P.*x22+1.5*x22.*y22;
plot(P,[T11_11;T11_12;T12_11;T12_12;T21_21;T21_22;T22_21;T22_22])
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!