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

gabarit(x,y)
function gabarit(x,y)

w=logspace(-2,2,1000);
amax=-30;
p=i*w;
switch y
case 'butterworth'
    amax=-30;
    amin=-3;
    [n WN]=buttord(0.02,0.1,amin,amax,'s');
     [z,P,k]=buttap(n);
 case 'chebychef'
     amax=-40;
     amin=-2;
    [n WN]=cheb1ord(0.02,0.1,amin,amax,'s');
     [z,P,k]=cheb1ap(n,-amin); 
case 'bessel'
     amax=-30;
    amin=-7;
     [z,P,k]=besselap(3);
 case 'cauer'
     amax=-40;
     amin=-2;
    [n WN]=ellipord(0.02,0.1,-amin,-amax,'s');
     [z,P,k]=ellipap(n,-amin,-amax); 
     
 end;     
[num den]=zp2tf(z,P,k);
switch x
case 'PL'
    [numfin denfin]=lp2lp(num,den,2);
    g=20*log10(abs(polyval(numfin,p)./polyval(denfin,p)));
    semilogx(w,g,'k','linewidth',2)
    hold on
    fill([0.01 100 100 0.01 0.01],[0 0 2 2 0],'y')
    fill([0.01 2 2 0.01 0.01],[amin,amin,-60,-60,amin],'y')
    fill([10 10 100 100 10],[0,amax,amax,0,0],'y')
    semilogx([0.01 2],[amin,amin],'r','linewidth',2)
    semilogx([2 2],[amin,-60],'r','linewidth',2)
    semilogx([0.01 10],[0 0],'r','linewidth',2)
    semilogx([10 100],[0 0],'k') 
    semilogx([10 10],[0,amax],'r','linewidth',2)
    semilogx([10 100],[amax,amax],'r','linewidth',2)
    semilogx([0.01 10],[amax amax],'--r')
    semilogx([2 2],[amin 0],'--r')
    semilogx([10 10],[amax 0],'--r')
    semilogx([0.5 0.5],[-60 3],'k')
    grid off
    set(gca,'xcolor','w','ycolor','w');
    axis([0.01 100 -60 2])
    if strcmp(y,'chebychef')||strcmp(y,'cauer')
        text(0.008,amin,'A_{MAX}','color','r','fontweight','bold','horizontalalignment','right')
    else
        text(0.008,amin,'- 3','color','r','fontweight','bold','horizontalalignment','right')
    end;   
     text(0.008,amax,'A_{min}','color','r','fontweight','bold','horizontalalignment','right')      
     text(2,5,'F_P','color','r','fontweight','bold')
     text(10,5,'F_A','color','r','fontweight','bold')
     text(0.008,0,'0','color','r','fontweight','bold')
     text(110,0,'F (Hz)')
     text(0.5,5,'G (dB)','horizontalalignment','center')
     if strcmp(y,'bessel')
         text(sqrt(10),-65,'MAIS PHASE LINEAIRE','fontweight','bold')
     end;         
case 'PH'
    [numfin denfin]=lp2hp(num,den,0.5);
    g=20*log10(abs(polyval(numfin,p)./polyval(denfin,p)));
    semilogx(w,g,'k','linewidth',2)
    hold on
    fill([0.01 100 100 0.01 0.01],[0 0 2 2 0],'y')
    fill([0.5,100,100,0.5,0.5],[amin,amin,-60,-60,amin],'y')
    fill([0.1,0.1,0.01,0.01,0.1],[0,amax,amax,0,0],'y')
    semilogx([0.5 100],[amin,amin],'r','linewidth',2)
    semilogx([0.5 0.5],[amin,-60],'r','linewidth',2)
    semilogx([0.1 100],[0 0],'r','linewidth',2)
    semilogx([0.01 0.1],[0 0],'k') 
    semilogx([0.1 0.1],[0,amax],'r','linewidth',2)
    semilogx([0.01 0.1],[amax,amax],'r','linewidth',2)
    semilogx([0.01 0.5],[amin amin],'--r')
    semilogx([0.5 0.5],[amin 0],'--r')
    semilogx([0.1 0.1],[amax 0],'--r')
    semilogx([0.025 0.025],[-60 3],'k')
    grid off
    set(gca,'xcolor','w','ycolor','w');
    axis([0.01 100 -60 2])
    if strcmp(y,'chebychef')|strcmp(y,'cauer')
        text(0.008,amin,'A_{MAX}','color','r','fontweight','bold','horizontalalignment','right')
    else
        text(0.008,amin,'- 3','color','r','fontweight','bold','horizontalalignment','right')
    end;  
    text(0.008,amax,'A_{min}','color','r','fontweight','bold','horizontalalignment','right')
    text(0.5,5,'F_P','color','r','fontweight','bold')
     text(0.1,5,'F_A','color','r','fontweight','bold')
     text(0.008,0,'0','color','r','fontweight','bold')
     text(110,0,'F (Hz)')
     text(0.025,5,'G (dB)','horizontalalignment','center')
     if strcmp(y,'bessel')
         text(sqrt(10),-65,'MAIS PHASE LINEAIRE','fontweight','bold')
     end;         
 case 'PB'
     F0=2;
     FAP=(15+sqrt(241))/2;
     FAM=FAP-15;
    [numfin denfin]=lp2bp(num,den,F0,3);
    g=20*log10(abs(polyval(numfin,p)./polyval(denfin,p)));
    semilogx(w,g,'k','linewidth',2)
    hold on
    fill([0.01 100 100 0.01 0.01],[0 0 2 2 0],'y')
    fill([1,4,4,1,1],[amin,amin,-60,-60,amin],'y')
    fill([FAM,FAM,0.01,0.01,FAM],[0,amax,amax,0,0],'y')
    fill([FAP,FAP,100,100,FAP],[0,amax,amax,0,0],'y')
    semilogx([1 4],[amin,amin],'r','linewidth',2)
    semilogx([1 1],[amin,-60],'r','linewidth',2)
    semilogx([4 4],[amin,-60],'r','linewidth',2)
    semilogx([FAM FAP],[0 0],'r','linewidth',2)
    semilogx([0.01 FAM],[0 0],'k') 
    semilogx([FAP 100],[0 0],'k') 
    semilogx([FAM FAM],[0,amax],'r','linewidth',2)
    semilogx([0.01 FAM],[amax,amax],'r','linewidth',2)
    semilogx([FAP FAP],[0,amax],'r','linewidth',2)
    semilogx([FAP 100],[amax,amax],'r','linewidth',2)
    semilogx([0.01 1],[amin amin],'--r')
    semilogx([1 1],[amin 0],'--r')
    semilogx([4 4],[amin 0],'--r')
    semilogx([FAM FAM],[amax 0],'--r')
    semilogx([FAP FAP],[amax 0],'--r')
    semilogx([0.025 0.025],[-60 3],'k')
    grid off
    set(gca,'xcolor','w','ycolor','w');
    axis([0.01 100 -60 2])
    if strcmp(y,'chebychef')||strcmp(y,'cauer')
        text(0.008,amin,'A_{MAX}','color','r','fontweight','bold','horizontalalignment','right')
    else
        text(0.008,amin,'- 3','color','r','fontweight','bold','horizontalalignment','right')
    end;  
    text(0.008,amax,'A_{min}','color','r','fontweight','bold','horizontalalignment','right')
    text(1,5,'F_P ^-','color','r','fontweight','bold')
    text(4,5,'F_P ^+','color','r','fontweight','bold')
     text(FAM,5,'F_A ^-','color','r','fontweight','bold')
     text(FAP,5,'F_A ^+','color','r','fontweight','bold')
     text(0.008,0,'0','color','r','fontweight','bold')
     text(110,0,'F (Hz)')
     text(0.025,5,'G (dB)','horizontalalignment','center')
     if strcmp(y,'bessel')
         text(sqrt(10),-65,'MAIS PHASE LINEAIRE','fontweight','bold')
     end;         
  case 'RB'
     F0=2;
     FPP=(15+sqrt(241))/2;
     FPM=FPP-15;
    [numfin denfin]=lp2bs(num,den,F0,FPP-FPM);
    g=20*log10(abs(polyval(numfin,p)./polyval(denfin,p)));
    semilogx(w,g,'k','linewidth',2)
    hold on
    fill([0.01 100 100 0.01 0.01],[0 0 2 2 0],'y')
    fill([1,4,4,1,1],[0,0,amax,amax,0],'y')
    fill([FPM,FPM,0.01,0.01,FPM],[amin,-60,-60,amin,amin],'y')
    fill([FPP,FPP,100,100,FPP],[amin,-60,-60,amin,amin],'y')
    semilogx([1 4],[amax,amax],'r','linewidth',2)
    semilogx([1 1],[amax,0],'r','linewidth',2)
    semilogx([4 4],[amax,0],'r','linewidth',2)
    semilogx([0.01 FPM],[0 0],'r','linewidth',2)
    semilogx([FPM 100],[0 0],'r','linewidth',2)
    semilogx([1 4],[0 0],'k') 
    semilogx([FPM FPM],[-60,amin],'r','linewidth',2)
    semilogx([0.01 FPM],[amin,amin],'r','linewidth',2)
    semilogx([FPP FPP],[-60,amin],'r','linewidth',2)
    semilogx([FPP 100],[amin,amin],'r','linewidth',2)
    semilogx([0.01 1],[amax amax],'--r')
    semilogx([1 1],[amax 0],'--r')
    semilogx([4 4],[amax 0],'--r')
    semilogx([FPM FPM],[amin 0],'--r')
    semilogx([FPP FPP],[amin 0],'--r')
    semilogx([FPP 0.01],[amin amin],'--r')
    semilogx([0.025 0.025],[-60 3],'k')
    grid off
    set(gca,'xcolor','w','ycolor','w');
    axis([0.01 100 -60 2])
    if strcmp(y,'chebychef')|strcmp(y,'cauer')
        text(0.008,amin,'A_{MAX}','color','r','fontweight','bold','horizontalalignment','right')
    else
        text(0.008,amin,'- 3','color','r','fontweight','bold','horizontalalignment','right')
    end;  
    text(0.008,amax,'A_{min}','color','r','fontweight','bold','horizontalalignment','right')
    text(1,5,'F_A ^-','color','r','fontweight','bold')
    text(4,5,'F_A ^+','color','r','fontweight','bold')
     text(FPM,5,'F_P ^-','color','r','fontweight','bold')
     text(FPP,5,'F_P ^+','color','r','fontweight','bold')
     text(0.008,0,'0','color','r','fontweight','bold')
     text(110,0,'F (Hz)')
     text(0.025,5,'G (dB)','horizontalalignment','center')
     if strcmp(y,'bessel')
         text(sqrt(10),-65,'MAIS PHASE LINEAIRE','fontweight','bold')
     end;         

end;
hold off

Contact us