function [ output_args ] = ps( input_args )
pi=3.14159;
p0=325;
f=30000;
ku=0.318;
kf=4;
p=300;
vin=203;
vp=203;
A21=0.4416;
n=7;
Io=12.5;
function g=g(ps,B,AE,AP)
g={1679021.09*p/(p+ps)+793719.0625+885302.03*[p/(p+ps)]^2}/{32054.4*[p/(p+ps)]^2*B^2*AE*AP}-ps;
for v=0:1:2
while(v==0) %EE42
AP=4.95;
AE=1.78;
end
while(v==1) %EE50
AP=5.73;
AE=2.26;
end
while(v==2) %EE55
AP=13.68;
AE=3.54;
end
dgdB=diff(g,B);
dgdB1=subs(dgdB,'diff(ps(B))','dpsdB')
dpsdB=solve(dgdB1,'dpsdB')
limit(B,dpsdB,0)
np=vp*10000/kf/B/f/AE;
j=pt*10000/kf/ku/B/f/AP;
Iin=p0/vin/y;
Axp=Iin/j;
snp=Axp/A21;
ns=np/n;
Axs=Io/j;
sns=Axs/A21;
r1=20*pi*np*0.03869/snp/100;
r2=20*pi*ns*0.03869/sns/100;
pcu=Iin^2*r1+Io^2*r2;
pfe=9.071*f^1.979*B^2.628*0.0437;
ps=pcu+pfe;
if (p/(p+ps)<0.9)
v=v+1;
end
end
end
end


pi=3.14159;
p0=325;
f=30000;
ku=0.318;
kf=4;
p=300;
vin=203;
vp=203;
A21=0.4416;
n=7;
Io=12.5;
function g=g(ps,B,AE,AP)
g={1679021.09*p/(p+ps)+793719.0625+885302.03*[p/(p+ps)]^2}/{32054.4*[p/(p+ps)]^2*B^2*AE*AP}-ps;
for v=0:1:2
while(v==0) %EE42
AP=4.95;
AE=1.78;
end
while(v==1) %EE50
AP=5.73;
AE=2.26;
end
while(v==2) %EE55
AP=13.68;
AE=3.54;
end
dgdB=diff(g,B);
dgdB1=subs(dgdB,'diff(ps(B))','dpsdB')
dpsdB=solve(dgdB1,'dpsdB')
limit(B,dpsdB,0)
np=vp*10000/kf/B/f/AE;
j=pt*10000/kf/ku/B/f/AP;
Iin=p0/vin/y;
Axp=Iin/j;
snp=Axp/A21;
ns=np/n;
Axs=Io/j;
sns=Axs/A21;
r1=20*pi*np*0.03869/snp/100;
r2=20*pi*ns*0.03869/sns/100;
pcu=Iin^2*r1+Io^2*r2;
pfe=9.071*f^1.979*B^2.628*0.0437;
ps=pcu+pfe;
if (p/(p+ps)<0.9)
v=v+1;
end
end
end
end

