H= 2.7
E= 1.05
V=1
g=5000000
p=5000000
f=50
dt=0.05
omega=0
base=g
G=g/base
M=(H*G)/(180*f)
Xs=0.4
Xe=1
pt=1
delta=asin((pt*Xs)/(E*V))
delta_d=delta*180/pi
dd=1
for t=0:0.05:0.5
pe_n=(E*V*sin(delta)/Xe)
pe=1-pe_n
pa=pe/M
if t==0
pa=pa/2
else
pa=pa
end
d_omega=pa*dt
omega=omega+d_omega
d_delta=omega*dt
plot(t,delta_d)
xlabel('in seconds')
ylabel('in \delta(degree')
delta_d=d_delta+delta_d
dd=dd+1
end

 Akzeptierte Antwort

Star Strider
Star Strider am 23 Mär. 2022

0 Stimmen

Try this —
H= 2.7;
E= 1.05;
V=1;
g=5000000;
p=5000000;
f=50;
dt=0.05;
omega=0;
base=g;
G=g/base;
M=(H*G)/(180*f);
Xs=0.4;
Xe=1;
pt=1;
delta=asin((pt*Xs)/(E*V));
delta_d=delta*180/pi;
dd=1;
tv=0:0.05:0.5;
figure
hold on
for k = 1:numel(tv)
t = tv(k);
pe_n=(E*V*sin(delta)/Xe);
pe=1-pe_n;
pa=pe/M;
if t==0
pa=pa/2;
else
pa=pa;
end
d_omega=pa*dt;
omega=omega+d_omega;
d_delta = omega*dt;
plot(t,delta_d, 'p');
xlabel('in seconds')
ylabel('in \delta(degree')
delta_d=d_delta+delta_d;
dd=dd+1;
end
hold off
Plotting individual points in the loop requires plotting with a marker.
.

10 Kommentare

Sanjay N
Sanjay N am 23 Mär. 2022
what is the reason in my program that i am not able to get graph
Sanjay N
Sanjay N am 23 Mär. 2022
can you please explain why my program doesnt plot graph and what may be the reason. It will be a great help
thank you
Star Strider
Star Strider am 23 Mär. 2022
Two reasons, actually.
The first is that you need to plot markers, not lines, because plotting lines requires two (x,y) values to plot a line between them. Markers plot points.
The second is that plotting in a loop requires the use of the hold function so that all the markers are plotted on the same axes. Otherwise, without using hold, the older plotted values are eliminated and the newer values plotted over them.
Walter Roberson
Walter Roberson am 23 Mär. 2022
plot() only draws lines between adjacent pairs of finite coordinates. You are passing in scalar values, so you do not have adjacent pairs of coordinates, so it does not draw any lines.
It does not draw any markers for you in your plot call because markers are off by default.
Sanjay N
Sanjay N am 23 Mär. 2022
clc
clear all
E=input('enter emf in pu')
V=input('enter voltage in pu')
f=input('enter frequency')
H=input('enter inertia constant')
g=input('enter generating power in VA')
P=input( 'enter power')
dt=0.05
omega=0
base=g
G=g/base
M=(G*H)/(180*f)
Xs=0.4
Xe=1
Pt=1
delta=asin((Pt*Xs)/(E*V))
delta _d=delta*180/pi
dd=1
for t=0:0.05:0.5
Pe_n=((E*V*sin(delta_d*pi/180))/Xe)
Pe=1-Pe_ n
Pa=Pe/M
if (t==0)
Pa=Pa/2
else
Pa=Pa
end
d_omega=Pa*dt
omega=d_omega+omega
d_delta=omega*dt
x(dd)=t
y(dd)=delta_d
plot(x,y)
delta_d=d_delta+delta_d
dd=dd+1
end
in these program you will get line graph why is that
Sanjay N
Sanjay N am 23 Mär. 2022
E=input('enter emf in pu')=1.05
V=input('enter voltage in pu')=1
f=input('enter frequency')=50
H=input('enter inertia constant')=2.7
g=input('enter generating power in VA')=5000000
P=input( 'enter power')=5000000
‘in these program you will get line graph why is that’
Because:
x(dd)=t
y(dd)=delta_d
are saved as vectors.
.
Sanjay N
Sanjay N am 23 Mär. 2022
i am sorry for annoying you please check above program and tell me why i am getting line graph
Sanjay N
Sanjay N am 23 Mär. 2022
got it scalars have no direction and vector has direction
Star Strider
Star Strider am 23 Mär. 2022
Not annoying at all!
Just short time intervals. I cannot immediately respond.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by