Code covered by the BSD License  

Highlights from
Logiciels temps réel

Logiciels temps réel

by

 

Real-time software concerning the domains of the signal processing, feedback and regulation

[wc,kc]=critique(k,N,D,R)
function [wc,kc]=critique(k,N,D,R)

if nargin==3
    R=0;
end;
f=logspace(-5,5,110);
p=1i*2*pi*f;
T=polyval(N,p)./polyval(D,p);
phi=dephasage_continu(angle(T)*180/pi);
phi=phi-k*90-R*360*f;
kphi=find(phi<=-180);
if isempty(kphi)
    wc=[];
    kc=[];
else
    ki=min(kphi)-1;
    kf=ki+2;
    ni=floor(log10(f(ki)));
    nf=ceil(log10(f(kf)));
    kphi=[];
    Nb=1e2;
    while (isempty(kphi)&&(Nb<1e6))
        Nb=10*Nb;
        f=logspace(ni,nf,Nb);
        p=1i*2*pi*f;
        T=polyval(N,p)./polyval(D,p);
        phi=dephasage_continu(angle(T)*180/pi);
        phi=phi-k*90-R*360*f;
        kphi=find(abs(phi+180)<=0.01);
    end;
    wc=2*pi*f(round(mean(kphi)));
    pc=1i*wc;
    TC=polyval(N,pc)/polyval(D,pc)/wc^k;
    kc=1/abs(TC);
end;

    

Contact us