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

det_exp_strejc.m
function [n,tau,ret]=det_exp_strejc(e,s,t,A,DEF,ei,si,ef)

sf=abs(A*(ef-ei));
k=find((abs(s)>0.1*sf)&(abs(s)<0.9*sf));   
P=polyfit(t(k)',s(k)/(A*(ef-ei)),5);
P1=polyder(P);
P2=polyder(P1);
r=roots(P2);
ki=find((imag(r)==0)&(r<max(t')));
ti=r(ki);
pente=polyval(P1,ti);
yi=polyval(P,ti);
Tu=ti-yi/pente;
Ta=1/pente;
[n,tau,ret]=modele_strejc(Tu,Ta);
NUM=[A];
DEN=puissance([tau,1],n);
sys=tf(NUM,DEN,'variable','p');
set(sys,'outputdelay',ret);
[v1,t1]=step(sys);
vsim=(ef-ei)*v1+si;
figure(2)
plot([Tu,Tu+Ta],[si,A*(ef-ei)+si],'k')
plot(t1,vsim,'g')
figure(3)
set(gcf,'position',ecran)
set(gcf,'color','w')
set(gcf,'unit','normalized')
grid off
set(gca,'color','w','xcolor','w','ycolor','w');
pause(0.1)
sn=num2str(A);
sn=['               ',sn];
lnum=length(sn)-7;
ns=num2str(n);
sd=['(1 + ',num2str(tau),'.p)^',ns];
sd=['            ',sd];
lden=length(sd)-7;
L=max(lnum,lden);
s='T(p) = ';
for k=1:1:L
    s=[s,'-'];
end;
T=num2str(ret);
s=[s,'.e^{-',T,'.p}'];
text(0.5,0.9,'MODELE DE STREJC','color','r','fontunits','normalized','fontsize',0.03,'fontweight','bold','horizontalalignment','center')
text(0.05,0.8,'Signaux :','color','m','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left')
text(0.1,0.75,['Valeur initiale entre : ',num2str(ei)],'color','b','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left')
text(0.1,0.7,['Valeur initiale sortie : ',num2str(si)],'color','b','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left')
text(0.05,0.6,'Fonction de transfert :','color','m','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left')
hn=text(0.1,0.52,sn,'color','b','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left','interpreter','Tex');
hT=text(0.1,0.5,s,'color','b','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left','interpreter','Tex');
hd=text(0.1,0.45,sd,'color','b','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left','interpreter','Tex');
[wc,kc]=critique(0,NUM,DEN,ret);
text(0.05,0.25,'Rgime critique :','color','m','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left')
text(0.1,0.20,['\omega_C = ',num2str(wc),' rad/s     T_C = ',num2str(2*pi/wc),' s'],...
     'color','b','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left','interpreter','Tex')
text(0.1,0.15,['K_C =',num2str(kc)],'color','b','fontunits','normalized','fontsize',0.027,'fontweight','bold','horizontalalignment','left','interpreter','Tex')

Contact us