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

definition_signal.m
function [MOG,DEF,s,x,X,K]=definition_signal(MOGi,DEFi,signal,s)

% 
%   DEF : matrice 8 lignes 1 colonne contenant les paramtres
%         caractristiques du signal (ils ne sont pas tous dfinis)
%           DEF(1) = amplitude (ou valeur crte  crte pour le carr, ou puissance du signal pour le bruit)
%           DEF(2) = Frquence
%           DEF(3) = phase
%           DEF(4) = composante continue
%           DEF(5) = rapport cyclique (signal carr)
%           DEF(6) = pente (pour dents de scie)
%           DEF(7) = retard
%           DEF(8) = nombre de voies (0 pour un signal simul)
%   s : chaine d'instructions dans le cas o le signal est dfini par
%       l'utilisateur (signal "AUTRE")
%   x,X,K : signal, FFT de x, indices FFT
%
%   Suivant la valeur du paramtre "signal", on fait appel  une fonction
%   "signal_..." (signal_sinus,signal_carre, ...)

DEF=DEFi;
te=DEF(10);
m=DEF(9);
MOG=MOGi;
MOG=on_efface_tout(MOGi);
boutonok=0;
DEF(1:8)=[1;1;0;0;50;1;0;0];
A=DEF(1);
f0=DEF(2);
phi=DEF(3);
CC=DEF(4);
ro=DEF(5);
pente=DEF(6);
ret=DEF(7);
x=zeros(2^m,1);
X=x;
K=(0:1:2^m-1)';
AS=num2str(A);
f0s=num2str(f0);
phis=num2str(phi);
CCs=num2str(CC);
ros=num2str(ro);
pentes=num2str(pente);
rets=num2str(ret);
%s=[];
switch signal
    case 2   %*******Sinus***************
        MOG(2,1)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.8 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Amplitude (V)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,1)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.75 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',AS,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','AS=get(MOG(1,1),''string'');A=str2num(AS);DEF(1)=A;');
        MOG(2,2)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.7 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Frquence (Hz)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,2)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.65 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',f0s,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','f0s=get(MOG(1,2),''string'');f0=str2num(f0s);DEF(2)=f0;');
        MOG(2,3)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.6 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Phase ()','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,3)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.55 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',phis,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','phis=get(MOG(1,3),''string'');phi=str2num(phis);DEF(3)=phi;');
        MOG(2,4)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.5 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Composante continue (V)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,4)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.45 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',CCs,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','CCs=get(MOG(1,4),''string'');CC=str2num(CCs);DEF(4)=CC;');
        boutonok=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0.6 0.1 0.1 0.1],...
	    'string','OK','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','x=signal_sinus(DEF);delete(gcf);[X,K]=fft_calcul(DEF,x);');
        %h=subplot(2,2,3);
        %pos=get(h,'position')
        t=(-50:1:100)/100;
        y=sin(2*pi*t+pi/4)+0.5;
        yp=sin(2*pi*t)+0.5;
        plot((0.5+t)/3,(y+0.5)/4,'k')
        hold on
        plot((0.5+t)/3,(yp+0.5)/4,'--k')
        set(gca,'xcolor','w','ycolor','w')
        axis([0 1 0 1])
        plot([0 0.5],[0.5/4 0.5/4],'k')
        plot([0.5/3 0.5/3],[0 0.5],'k')
        plot([0 0.5],[1/4 1/4],'--r')
        MOG(4,1)=annotation(gcf,'doublearrow',[0.2907 0.29],[0.5159 0.3142],'linewidth',2,'color','r');
        text((0.5+1/8)/3,(1+0.5)/4,'A','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','left')
         MOG(4,2)=annotation(gcf,'doublearrow',[0.41 0.41],[0.2113 0.3132],'linewidth',2,'color','r');
        text((0.5+5/8)/3,(0.25+0.5)/4,'Comp. Cont','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','left')
         MOG(4,3)=annotation(gcf,'textarrow',[0.3943 0.3629],[0.4735 0.4406],...
            'TextEdgeColor','none','String',{'\phi = 0'});
         MOG(4,4)=annotation(gcf,'textarrow',[0.1957 0.235],[0.4194 0.3662],...
            'TextEdgeColor','none','String',{'\phi = \pi/4 = 45'});
        hold off
    case 3   %***********carr****************
        MOG(2,1)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.8 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Valeur crte  crte (V)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,1)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.75 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',AS,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','AS=get(MOG(1,1),''string'');A=str2num(AS);DEF(1)=A;');
        MOG(2,2)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.7 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Frquence (Hz)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,2)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.65 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',f0s,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','f0s=get(MOG(1,2),''string'');f0=str2num(f0s);DEF(2)=f0;');
        MOG(2,3)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.6 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Retard (% priode)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,3)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.55 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',rets,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','rets=get(MOG(1,3),''string'');ret=str2num(rets);DEF(7)=ret;');
        MOG(2,4)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.5 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Composante continue (V)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,4)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.45 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',CCs,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','CCs=get(MOG(1,4),''string'');CC=str2num(CCs);DEF(4)=CC;');
        MOG(2,5)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.4 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Rapport cyclique (%)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,5)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.35 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',ros,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','ros=get(MOG(1,5),''string'');ro=str2num(ros);DEF(5)=ro;');
        boutonok=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0.6 0.1 0.1 0.1],...
	    'string','OK','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','x=signal_carre(DEF);delete(gcf);[X,K]=fft_calcul(DEF,x);');
        t=(-500:1:1000)/1000;
        %tr=asin(sin(2*pi*t-50*pi/100+pi/2))/pi+0.5;
        %y=(tr>=0.9)-0.1;
        tr=asin(sin(2*pi*t+pi/2))/pi+0.5;
        yp=(tr>=0.9)-0.1;
        tr=asin(sin(2*pi*t+pi/2-50*pi/100))/pi+0.5;
        yt=(tr>=0.9)+0.1;
        %plot((0.5+t)/3,(y+0.5)/4,'--r')
        hold on
        plot((0.5+t)/3,(yp+0.5)/4,'r','linewidth',2)
        hold on
         plot((0.5+t)/3,(yt+0.5)/4,'m','linewidth',2)
         plot([0.5+min(t),0.5+max(t)]/3,[0.2+0.5,0.2+0.5]/4,'--m','linewidth',2)
        set(gca,'xcolor','w','ycolor','w')
        axis([0 1 0 1])
        plot([0 0.5],[0.5/4 0.5/4],'k')
        plot([0.5/3 0.5/3],[0 0.5],'k')
        %plot([0 0.5],[1/4 1/4],'--r')
         MOG(4,1)=annotation(gcf,'doublearrow',[0.1257 0.1257],[0.2113 0.2569],...
                 'LineWidth',2,'Color',[1 0 1]);
        text(-0.3/3,(0.1+0.5)/4,'Comp. Cont.','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','m','horizontalalignment','left')
         MOG(4,2)=annotation(gcf,'doublearrow',[0.4929 0.4929],[0.1943 0.3949],'LineWidth',2,'Color',[1 0 0]);
        text((0.5+0.8)/3,(0.4+0.5)/4,'V_{CC}','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','left')
         MOG(4,3)=annotation(gcf,'textarrow',[0.1836 0.2457],[0.4268 0.3938],...
                    'TextEdgeColor','none','TextLineWidth',2,'FontWeight','bold','fontunits','normalized','fontsize',0.02,...
                 'String',{'Retard=0','Composante continue=0','rapport cyclique = 10%'},...
                'LineWidth',2,...
                'Color',[1 0 0]);     
         MOG(4,4)=annotation(gcf,'arrow',[0.2729 0.335],[0.3249 0.3249],'LineWidth',2);
         text((0.5+0.1)/3,(0.65+0.5)/4,'Ret','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','k','horizontalalignment','left')
         MOG(4,5)=annotation(gcf,'doublearrow',[0.3114 0.3371],[0.4449 0.4448],'LineWidth',2,'Color',[1 0 1]);
         text((0.25+0.5)/3,(0.5+1.25)/4,'\theta','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','m','horizontalalignment','center')
      %  text(1/3,1/2,'T','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','b','horizontalalignment','center')
      %   MOG(4,6)=annotation(gcf,'doublearrow',[0.2429 0.2729],[0.4077 0.4076],'linewidth',2,'color','b');
      %  text(1/6,1.5/4,'\theta','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','b','horizontalalignment','center')
          text(0,(-0.2+0.5)/4,'rapport cyclique = \rho = \theta/T','fontweight','bold','color','b','horizontalalignment','left')
        text(0,(-0.4+0.5)/4,'(Exemple de la figure : \rho = 10%, Retard = 25%, V_{CC}=1V, Comp Cont=0,1 V)',...
            'fontunits','normalized','fontsize',0.02,'fontweight','bold','color','m',...
            'horizontalalignment','left')
        hold off
    case 4  % *******triangle**********
        MOG(2,1)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.8 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Amplitude (V)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,1)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.75 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',AS,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','AS=get(MOG(1,1),''string'');A=str2num(AS);DEF(1)=A;');
        MOG(2,2)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.7 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Frquence (Hz)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,2)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.65 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',f0s,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','f0s=get(MOG(1,2),''string'');f0=str2num(f0s);DEF(2)=f0;');
        MOG(2,3)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.6 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Phase ()','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,3)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.55 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',phis,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','phis=get(MOG(1,3),''string'');phi=str2num(phis);DEF(3)=phi;');
        MOG(2,4)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.5 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Composante continue (V)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,4)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.45 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',CCs,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','CCs=get(MOG(1,4),''string'');CC=str2num(CCs);DEF(4)=CC;');
        
        boutonok=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0.6 0.1 0.1 0.1],...
	    'string','OK','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','x=signal_triangle(DEF);delete(gcf);[X,K]=fft_calcul(DEF,x);');
        t=(-500:1:1000)/1000;
        y=2*asin(sin(2*pi*t-pi/4))/pi+0.5;
        yp=2*asin(sin(2*pi*t))/pi+0.5;
        plot((0.5+t)/3,(y+0.5)/4,'k')
        hold on
        plot((0.5+t)/3,(yp+0.5)/4,'--k')
        set(gca,'xcolor','w','ycolor','w')
        axis([0 1 0 1])
        plot([0 0.5],[0.5/4 0.5/4],'k')
        plot([0.5/3 0.5/3],[0 0.5],'k')
        plot([0 0.5],[1/4 1/4],'--r')
         MOG(4,1)=annotation(gcf,'doublearrow',[0.324 0.324],[0.5128 0.3153],'linewidth',2,'color','r');
        text((0.5+1/4)/3,(1+0.5)/4,'A','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','left')
         MOG(4,2)=annotation(gcf,'doublearrow',[0.41 0.41],[0.2113 0.3132],'linewidth',2,'color','r');
        text((0.5+5/8)/3,(0.25+0.5)/4,'Comp. Cont','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','left')
         MOG(4,3)=annotation(gcf,'textarrow',[0.225 0.28],[0.4162 0.3832],...
            'TextEdgeColor','none','String',{'\phi = 0'});
         MOG(4,4)=annotation(gcf,'textarrow',[0.4221 0.3829],[0.4703 0.4321],...
            'TextEdgeColor','none','String',{'\phi = -\pi/4 = -45'});
        
        hold off
    
    case 5   %************impulsions*****************
        MOG(2,1)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.8 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Amplitude (V)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,1)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.75 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',AS,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','AS=get(MOG(1,1),''string'');A=str2num(AS);DEF(1)=A;');
        MOG(2,2)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.7 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Frquence (Hz)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,2)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.65 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',f0s,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','f0s=get(MOG(1,2),''string'');f0=str2num(f0s);DEF(2)=f0;');
        MOG(2,7)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.5 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Retard (s)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,7)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.45 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',rets,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','rets=get(MOG(1,7),''string'');ret=str2num(rets);DEF(7)=ret;');
        
        boutonok=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0.6 0.1 0.1 0.1],...
	    'string','OK','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','x=signal_impulsions(DEF);delete(gcf);[X,K]=fft_calcul(DEF,x);');
        t=(-5000:1:10000)/10000;
        kt=find((t==-0.5)|(t==0)|(t==0.5)|(t==1));
        yp=zeros(size(t));
        yp(kt)=1;
        kt=find((t==-0.5+0.2)|(t==0.2)|(t==0.5+0.2)|(t==1+0.2));
        y=zeros(size(t));
        y(kt)=1;
        plot((0.5+t)/3,(y+0.5)/4,'k','linewidth',2)
        hold on
        plot((0.5+t)/3,(yp+0.5)/4,'b','linewidth',2)
        set(gca,'xcolor','w','ycolor','w')
        axis([0 1 0 1])
        plot([0 0.5],[0.5/4 0.5/4],'k')
        plot([0.5/3 0.5/3],[0 0.5],'k')
         MOG(4,1)=annotation(gcf,'doublearrow',[0.445 0.4457],[0.4141 0.2155],'linewidth',2,'color','r');
        text((0.5+0.75)/3,1/4,'A/t_e','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','left')
         MOG(4,2)=annotation(gcf,'arrow',[0.4136 0.3886],[0.413 0.413],'linewidth',2,'color','r');
         MOG(4,3)=annotation(gcf,'arrow',[0.3557 0.3879],[0.413 0.413],'linewidth',2,'color','r');
        text(1/3,1.6/4,'t_e','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','center')
         MOG(4,4)=annotation(gcf,'arrow',[0.2593 0.31],[0.308 0.308],'linewidth',2,'color','r');
        text(0.6/3,1.1/4,'Retard','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','center')
         MOG(4,5)=annotation(gcf,'textarrow',[0.2943 0.2607],[0.465 0.4151],'color','b',...
            'TextEdgeColor','none','String',{'Retard=0'});
         MOG(4,6)=annotation(gcf,'doublearrow',[0.3121 0.4407],[0.2676 0.2675],'LineWidth',2);
        text(0.85/3,0.85/4,'T = 1/f','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','k','horizontalalignment','left')
        hold off
        
    
    case 6   %*******dents de scie*****************
        MOG(2,1)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.8 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Amplitude (V)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,1)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.75 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',AS,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','AS=get(MOG(1,1),''string'');A=str2num(AS);DEF(1)=A;');
        MOG(2,2)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.7 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Frquence (Hz)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,2)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.65 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',f0s,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','f0s=get(MOG(1,2),''string'');f0=str2num(f0s);DEF(2)=f0;');
        MOG(2,3)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.6 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Phase ()','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,3)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.55 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',phis,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','phis=get(MOG(1,3),''string'');phi=str2num(phis);DEF(3)=phi;');
        MOG(2,4)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.5 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Composante continue (V)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,4)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.45 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',CCs,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','CCs=get(MOG(1,4),''string'');CC=str2num(CCs);DEF(4)=CC;');
        MOG(2,6)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.4 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','pente (+1 ou -1)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,6)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.35 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',pentes,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','pentes=get(MOG(1,6),''string'');pente=str2num(pentes);DEF(6)=pente;');
        t=(-500:1:1000)/1000;
        y=2*atan(tan(pi*t-pi/4))/pi+0.5;
        yp=2*atan(tan(pi*t))/pi+0.5;
        plot((0.5+t)/3,(y+0.5)/4,'k','linewidth',2)
        hold on
        plot((0.5+t)/3,(yp+0.5)/4,'--k','linewidth',2)
        set(gca,'xcolor','w','ycolor','w')
        axis([0 1 0 1])
        plot([0 0.5],[0.5/4 0.5/4],'k')
        plot([0.5/3 0.5/3],[0 0.5],'k')
        plot([0 0.5],[1/4 1/4],'--r')
        y=2*atan(-tan(pi*t))/pi+0.5;
        plot((0.5+t)/3,(y+0.5)/4,'--b')
         MOG(4,1)=annotation(gcf,'doublearrow',[0.205 0.2043],[0.3164 0.5191],'linewidth',2,'color','r');
        text((0.5-0.2)/3,1.5/4,'A','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','left')
         MOG(4,2)=annotation(gcf,'arrow',[0.1336 0.1343],[0.2134 0.3132],'linewidth',2,'color','r');
         text((0.5-0.45)/3,0.75/4,'Comp. Cont.','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','left')
         MOG(4,3)=annotation(gcf,'textarrow',[0.3093 0.3507],[0.5277 0.4671],...
            'TextEdgeColor','none','String',{'\phi=0 ; pente = +1'});
        MOG(4,4)=annotation(gcf,'textarrow',[0.3964 0.4386],[0.585 0.4947],...
            'TextEdgeColor','none','String',{'\phi = -\pi/4 = -45 ; pente = +1'});
        MOG(4,5)=annotation(gcf,'textarrow',[0.2907 0.3507],[0.103 0.1635],...
            'TextEdgeColor','none','TextColor',[0 0 1],'String',{'\phi = 0 ; pente = - 1'},'Color',[0 0 1]);
        hold off
        boutonok=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0.6 0.1 0.1 0.1],...
	    'string','OK','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','x=signal_dent_scie(DEF);delete(gcf);[X,K]=fft_calcul(DEF,x);');
    case 7   %********bruit****************
        MOG(2,1)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.6 0.8 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Puissance signal (V^2)','fontunits','normalized','fontsize',0.5,'fontweight','bold');
        MOG(1,1)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.6 0.75 0.3 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',AS,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','AS=get(MOG(1,1),''string'');A=str2num(AS);DEF(1)=A;');
         t=(-50:1:100)/100;
        y=randn(size(t));
        ymin=min(y);
        ymax=max(y);
        plot((0.5+t)/3,0.25+0.5*y/(ymax-ymin),'k','linewidth',2)
        hold on
        plot([0 0.5],[0.25 0.25],'k')
        plot([0.5/3 0.5/3],[0 0.5],'k')
        set(gca,'xcolor','w','ycolor','w')
        axis([0 1 0 1])
        text(0.1,0.55,'Puissance signal = <x^2>','fontunits','normalized','fontsize',0.02,'fontweight','bold','color','r','horizontalalignment','left')
        hold off
        boutonok=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0.6 0.1 0.1 0.1],...
	    'string','OK','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','x=signal_bruit(DEF);delete(gcf);[X,K]=fft_calcul(DEF,x);');
     case 8   %*******autre**********
        MOG(2,1)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.1 0.7 0.3 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Dfinition du signal','fontunits','normalized','fontsize',0.5,'fontweight','bold');
         MOG(2,2)=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.1 0.65 0.8 0.05],'backgroundcolor','w',...
	           'foregroundcolor','b','string','Exemple : f1=10;f2=1;k=0.5;x=(1+k*cos(2*pi*f2*t)).*sin(2*pi*f1*t);','fontunits','normalized','fontsize',0.5,'fontweight','bold'); 
        %s='f1=10;f2=1;k=0.5;x=(1+k*cos(2*pi*f2*t)).*sin(2*pi*f1*t);';
    
        MOG(1,1)=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.1 0.6 0.9 0.05],'backgroundcolor','y',...
	    'foregroundcolor','b','max',1,...
		'string',s,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
		'callback','s=get(MOG(1,1),''string'');');
       
        boutonok=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0.6 0.1 0.1 0.1],...
	    'string','OK','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','s=get(MOG(1,1),''string'');[x,X,K]=signal_autre(s,DEF);');
    
end;

Contact us