⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optim.asv

📁 Doherty功放的相关特性的仿真代码
💻 ASV
字号:
%Explanation:Optimisation of the driving signal for a general Z matrix
%output network given the best choice of driving signals in terms of
%efficiency.
%Function [I1,I2]=optim(Z,I1max,I2max,Vdd,Zload);
%
%I1max,I2max:Maximum current at the fundamental, peak value.(Not maximum
%device current).
%
%Z, is a 3x3 Zmatrix
%Vdd,Drain voltage.
%Zload,load impedance to which the port 3 of the network is terminated.
%wujianfeng
%2007-02-26
%Sweden
function [I1,I2,V1,V2,V3,E]=optim(Z,I1max,I2max,Vdd,Zload);

N=0;
P1max=Vdd*I1max/2;
P2max=Vdd*I2max/2;
PEP=P1max+P2max;
Top_Eff=100;
K=Top_Eff*4/100;

Vmax=sqrt(PEP*2*Zload);

OPTIONS=OPTIMSET('MaxIter',5000,'TolFun',0.0001,'TolX',0.0001);

Vout=[0:Vmax/(N-1):Vmax];

xo=[30];

for n=2:N,
    
    [x,feavl,exitflag,output]=fminsearch(@err,xo,OPTIONS,Z,Zload,Vout(n),Vdd,I1max,I2max);
    
    [fel(n),I1(n),I2(n),V1(n),V2(n)]=auxiliar(x,Z,Zload,Vout(n),Vdd,I1max,I2max);
    
    V3(n)=(Z(3,1)*I1(n)+Z(3,2)*I2(n))*Zload/(Zload+Z(3,3));
    
    Idc1=2*abs(I1(n))/K; %Idc=Irfmax/pi for class B, Irfmax=2*I1.
    Idc2=2*abs(I2(n))/K;
    P(n)=abs(V3(n)).^2/(2*Zload);
    Pdc(n)=(Idc1+Idc2).*Vdd;
    E(n)=100*P(n)./Pdc(n);
    xo=x;
    n
end

function fel=err(xo,Z,Zload,Vout,Vdd,I1max,I2max);
[fel,I1,I2,V1,V2]=auxiliar(xo,Z,Zload,Vout,Vdd,I1max,I2max);

function [fel,I1,I2,V1,V2]=auxiliar(xo,Z,Zload,Vout,Vdd,I1max,I2max)

N=1000;
m=1e-2;
xo=abs(xo);
xo=xo.*(xo<=Vdd)+Vdd.*(xo>Vdd);
f=[-pi:2*pi/(N-1):pi];
V1=abs(xo).*exp(j*f);
V3=Vout;
I1=-(V3.*Z(1,2).*(-Z(3,3)-Zload)+V3.*Z(1,3).*Z(3,2)+Zload.*V1.*Z(3,2))./(Zload.*Z(1,2).*Z(3,1)-Zload.*Z(1,1).*Z(3,2));
I2=+(V3.*Z(1,1).*(-Z(3,3)-Zload)+V3.*Z(1,3).*Z(3,1)+Zload.*V1.*Z(3,1))./(Zload.*Z(1,2).*Z(3,1)-Zload.*Z(1,1).*Z(3,2));
indexI=find(abs(I1)<=I1max & abs(I2)<=I2max);%Possible solutions for the angle f that solves with a current under the maximum.
if ~isempty(indexI),
    I1=I1(indexI);
    I2=I2(indexI);
    f=f(indexI);
    %Calculate V2.
    V2=Z(2,1).*I1+Z(2,2).*I2-Z(2,3)*Vout/Zload;
    indexV=find(abs(V2)<=Vdd*(1+m));
    if ~isempty(indexV),
        I1=I1(indexV);
        I2=I2(indexV);
        V2=V2(indexV);
        f=f(indexV);
        S=abs(I1)+abs(I2);
        [Im,indexS]=min(abs(I1)+abs(I2));
        fel=S(indexS);
        I1=I1(indexS);
        I2=I2(indexS);
        V2=V2(indexS);
        f=f(indexS);
        V1=xo.*exp(j*f);
    else
        fel=100;
    end
else
    fel=100;
end
if fel==100,
    I1=0;
    I2=0;
    V1=0;
    V2=0;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -