You are on page 1of 1

Vm=input('enter Vm in volts= ');

f=input('enter frequency in hz= ');


R=input('enter resistance in ohms= ');
alpha=input('enter angle b/w 0 to 180= ');
for(n=1:360)
theta=(n*pi)/180;
X(n)=n
if(n<alpha)
i(n)=0;
Vo(n)=0;
Vt1(n)=Vm*sin(theta)
else if(n>=alpha)&(n<=180)
i(n)=(Vm*sin(theta))/R;
Vo(n)=i(n)*R;
Vt1(n)=0;
else if((n>180)&&(n<180+alpha))
i(n)=0;
Vo(n)=0;
Vt1(n)=Vm*sin(theta);
else
i(n)=(Vm*sin(theta))/R;
Vo(n)=i(n)*R;
Vt1(n)=0;
end
end
end
end
plot(X,i,'r',X,Vo,'g',X,Vt1,'b');

You might also like