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

[MOG,DEF,P_smith,P_ret]=def_smith(MOGi,snr,sdr,sng,sdg,DEFi)
function [MOG,DEF,P_smith,P_ret]=def_smith(MOGi,snr,sdr,sng,sdg,DEFi)

NUM=[1 1];
DEN=[1 1];
P_smith=ones(9,2);
P_ret=zeros(1,5000);
P_ret(1)=1;
te=DEFi(1);
DEF=DEFi;
MOG=MOGi;
if snr(end)~=';'
    snr=[snr,';'];
end;
if sdr(end)~=';'
    sdr=[sdr,';'];
end;
if sng(end)~=';'
    sng=[sng,';'];
end;
if sdg(end)~=';'
    sdg=[sdg,';'];
end;
test1=findstr(snr,'NUM=');
if isempty(test1)
    MOG(4,5)=uicontrol(gcf,'style','text',...
        'unit','normalized',...
        'position',[0.1 0.5 0.8 0.05],...
        'backgroundcolor','w',...
         'foregroundcolor','r',...
         'string','DEFINIR LES COEFFICIENTS PAR NUM=...',...
         'fontunits','normalized','fontsize',0.5,'fontweight','bold');
    pause(1)
    delete(MOG(4,5)); 
    return;
else
    try
        eval(snr);
    catch
        MOG(4,5)=uicontrol(gcf,'style','text',...
            'unit','normalized',...
            'position',[0.1 0.5 0.8 0.05],...
            'backgroundcolor','w',...
            'foregroundcolor','r',...
            'string','ERREUR DE PROGRAMMATION !',...
            'fontunits','normalized','fontsize',0.5,'fontweight','bold'); 
        pause(1)
        delete(MOG(4,5)); 
        return;
    end;
end;
test2=findstr(sdr,'DEN=');
if isempty(test2)
    MOG(4,6)=uicontrol(gcf,'style','text',...
        'unit','normalized',...
        'position',[0.1 0.3 0.8 0.05],...
        'backgroundcolor','w',...
        'foregroundcolor','r',...
        'string','DEFINIR LES COEFFICIENTS PAR DEN=...',...
        'fontunits','normalized','fontsize',0.5,'fontweight','bold');
    pause(1)
    delete(MOG(4,6)); 
    return;
else
    try
        eval(sdr);
    catch
        MOG(4,6)=uicontrol(gcf,'style','text',...
            'unit','normalized',...
            'position',[0.1 0.3 0.8 0.05],...
            'backgroundcolor','w',...
             'foregroundcolor','r',...
             'string','ERREUR DE PROGRAMMATION !',...
             'fontunits','normalized','fontsize',0.5,'fontweight','bold'); 
        pause(1)
        delete(MOG(4,6)); 
        return;
    end;
end;
NUMR=NUM;
DENR=DEN;
Hr=tf(NUMR,DENR);
Hdr=c2d(Hr,te,'tustin');
[NUMRZ,DENRZ]=tfdata(Hdr,'v');
test1=findstr(sng,'NUM=');
if isempty(test1)
    MOG(4,5)=uicontrol(gcf,'style','text',...
        'unit','normalized',...
        'position',[0.1 0.5 0.8 0.05],...
        'backgroundcolor','w',...
        'foregroundcolor','r',...
        'string','DEFINIR LES COEFFICIENTS PAR NUM=...',...
        'fontunits','normalized','fontsize',0.5,'fontweight','bold');
    pause(1)
    delete(MOG(4,5)); 
    return;
else
    try
        eval(sng);
    catch
        MOG(4,5)=uicontrol(gcf,'style','text',...
            'unit','normalized',...
            'position',[0.1 0.5 0.8 0.05],...
            'backgroundcolor','w',...
        'foregroundcolor','r',...
        'string','ERREUR DE PROGRAMMATION !',...
        'fontunits','normalized','fontsize',0.5,'fontweight','bold'); 
        pause(1)
        delete(MOG(4,5)); 
        return;
    end;
end;
test2=findstr(sdg,'DEN=');
if isempty(test2)
    MOG(4,6)=uicontrol(gcf,'style','text',...
        'unit','normalized',...
        'position',[0.1 0.3 0.8 0.05],...
        'backgroundcolor','w',...
        'foregroundcolor','r',...
        'string','DEFINIR LES COEFFICIENTS PAR DEN=...',...
        'fontunits','normalized','fontsize',0.5,'fontweight','bold');
    pause(1)
    delete(MOG(4,6)); 
    return;
else
    try
        eval(sdg);
    catch
        MOG(4,6)=uicontrol(gcf,'style','text',...
            'unit','normalized',...
        'position',[0.1 0.3 0.8 0.05],...
        'backgroundcolor','w',...
        'foregroundcolor','r',...
        'string','ERREUR DE PROGRAMMATION !',...
        'fontunits','normalized','fontsize',0.5,'fontweight','bold'); 
        pause(1)
        delete(MOG(4,6)); 
        return;
    end;
end;
NUMG=NUM;
DENG=DEN;
Hg=tf(NUMG,DENG);
Hdg=c2d(Hg,te,'tustin');
[NUMGZ,DENGZ]=tfdata(Hdg,'v');
P=meme_longueur(NUMR,DENR,NUMRZ,DENRZ,NUMG,DENG,NUMGZ,DENGZ);
R=zeros(size(P(1,:)));
retards=get(MOG(1,5),'string');
retard=str2num(retards);
R(1)=retard;
P_smith=[P;R];
P_ret=zeros(1,5000);
P_ret(1)=1;
k=round(retard/DEF(1));
P_ret(k)=-1;
lance_correcteur_smith;



Contact us