obtaining p-v curves using Matlab

9 Ansichten (letzte 30 Tage)
Shahabullah Amin
Shahabullah Amin am 26 Apr. 2018
Kommentiert: Walter Roberson am 29 Apr. 2018
hi, everyone, I am trying to Obtain P-V curves using Matlab can anyone help me through it, please
  4 Kommentare
Shahabullah Amin
Shahabullah Amin am 28 Apr. 2018
it's plotting the result in the not solving area which I have shown in the picture with the circle
Shahabullah Amin
Shahabullah Amin am 28 Apr. 2018

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Walter Roberson
Walter Roberson am 28 Apr. 2018
clc;
clear all
syms X
z=0.1+0.5*1j;
Vs=1;
A=1;
a1=real(A); a2=imag(A);
A=a1+a2*1j;
B=z;
b1=real(B); b2=imag(B);
C=0;
D=A;
fi=acos(1);
K1=a1*(b2-b1*tan(fi))+a2*(b1+b2*tan(fi));
K2=a1*(b1+b2*tan(fi))+a2*(b1-b2*tan(fi));
deltarcrit=(pi/4)+0.5*atan(K2/-K1);
Vrcrit=Vs/(2*(a1*cos(deltarcrit)+a2*sin(deltarcrit)));
K3=b1*cos(deltarcrit)+b2*sin(deltarcrit);
K4=a1*cos(deltarcrit)+a2*sin(deltarcrit);
Prcrit=((Vs^2)*(2*K3*K4-(a1*b1+a2*b2)))/((b1^2+b2^2)*4*K4);
Vr=[];
for P=0.1:0.01:1
Qr=P*tan(fi);
P1=a1^2+a2^2;
P2=2*P*(a1*b1+a2*b2)+2*Qr*(a1*b2+a2*b1)-Vs^2;
P3=((b1+b2).^2)*(P^2+Qr^2);
equation=P1*(X^2)+P2*X+P3;
these_roots = roots([P1 P2 P3]);
mask = any(imag(these_roots) ~= 0,2);
these_roots(mask,:) = nan;
Vr=[Vr these_roots];
end
Pr=(0.1:0.01:1);
plot(Pr,Vr.')
display(Prcrit)
  1 Kommentar
Walter Roberson
Walter Roberson am 28 Apr. 2018
The area that it does not draw is the area where the roots go complex.
If you change the P loop to
syms P
Qr=P*tan(fi);
P1=a1^2+a2^2;
P2=2*P*(a1*b1+a2*b2)+2*Qr*(a1*b2+a2*b1)-Vs^2;
P3=((b1+b2).^2)*(P^2+Qr^2);
equation=P1*(X^2)+P2*X+P3;
Vr = solve(equation, X);
then because you do not change anything other than P in the loop, you can get the general form, which is
equation = (9*P^2)/25 + X^2 + X*(P/5 - 1)
and then Vr is
1/2 - (5^(1/2)*(-(7*P - 5)*(P + 1))^(1/2))/10 - P/10
(5^(1/2)*(-(7*P - 5)*(P + 1))^(1/2))/10 - P/10 + 1/2
That has a term
(-(7*P - 5)*(P + 1))^(1/2)
so the equation is real-valued if -(7*P - 5)*(P + 1) is positive. When P is positive (as is the case in your for loop), P+1 is always positive. So real or imaginary is going for the root is going to have a boundary when 7*P - 5 becomes 0, which is P = 5/7 which is about 0.714285714285 . Below that you have real roots; above that you have only imaginary roots.

Melden Sie sich an, um zu kommentieren.


Shahabullah Amin
Shahabullah Amin am 29 Apr. 2018
the plotted signal should be like this
  1 Kommentar
Walter Roberson
Walter Roberson am 29 Apr. 2018
Use a higher resolution on P.
Or use the symbolic form I showed, and then
fplot(Vr, [0 0.75])
The code you posted certainly does not have real-valued solutions as far out as 2.7

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by