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

fenetre.m
function [K,X]=fenetre(c,x,DEF);


m=DEF(9);
te=DEF(10);
MOG=zeros(4,7);
N=2^m;
switch c
    case 'Rectangulaire'
        w=window(@rectwin,N);
    case 'Triangulaire (Bartlett)'
        w=window(@bartlett,N);
    case 'Hann'
        w=window(@hann,N);
    case 'Hamming'
        w=window(@hamming,N);
    case 'Blackman'
        w=window(@blackman,N);
    case 'Flattop'
        w=window(@flattopwin,N);
end;
% correction pour obtenir une amplitude correcte
coeff=sum(w)/N;
w=w/coeff;
[X,K]=fft_tfd(x,w);
e=ecran;
if e(1)<0
    e(1)=0;
end;
figure(2)
set(gcf,'position',e)
[ligne,col]=size(x);
if col==1
    spectre(K,abs(X),'b',2)
    v=axis;
    v(1:2)=[0,N/2];
    dx=v(2)-v(1);
    dy=v(4)-v(3);
    axis(v)
    xlabel('k','fontunits','normalized','fontsize',0.03,'fontweight','bold')
    ylabel('|X_k|','fontunits','normalized','fontsize',0.03,'fontweight','bold')
    s=['F.F.T. de x_n : N = ',num2str(2^m),' ; F_E = ',num2str(1/te),' Hz ; Rsolution : F_E/N = ',num2str(1/(2^m*te)),' Hz ; fentre : ',c];
    title(s,'fontunits','normalized','fontsize',0.03,'fontweight','bold')
    grid on
else
    subplot(2,1,1)
    spectre(K,abs(X(:,1)),'b',2)
    v=axis;
    v(1:2)=[0,N/2];
    axis(v)
    xlabel('k','fontunits','normalized','fontsize',0.03,'fontweight','bold')
    ylabel('|X_k| (voie 0)','fontunits','normalized','fontsize',0.03,'fontweight','bold')
    s=['F.F.T. de x_n : N = ',num2str(2^m),' ; F_E = ',num2str(1/te),' Hz ; Rsolution : F_E/N = ',num2str(1/(2^m*te)),' Hz ; fentre : ',c];
    title(s,'fontunits','normalized','fontsize',0.03,'fontweight','bold')
    set(gca,'ButtonDownFcn',@fft_zoom)
    grid on
    subplot(2,1,2)
    spectre(K,abs(X(:,2)),'b',2)
    v=axis;
    v(1:2)=[0,N/2];
    axis(v)
    xlabel('k','fontunits','normalized','fontsize',0.03,'fontweight','bold')
    ylabel('|X_k| (voie 1)','fontunits','normalized','fontsize',0.03,'fontweight','bold')
    set(gca,'ButtonDownFcn',@fft_zoom)
    grid on
end;  
hgcf=get(gcf,'child');
test=[];
lgcf=length(hgcf);
for kgcf=1:1:lgcf
    test=[test;strcmp(get(hgcf(kgcf),'type'),'uimenu')];
end
if ~any(test)
    hh=uimenu('label','SAUVER LE SPECTRE','foregroundcolor','r','callback','fft_sauve_spectre(X);');
    hh1=uimenu('label','AFFICHER 2 SPECTRES','foregroundcolor','r','callback','load(''X1.mat'');affiche_2_spectre(X1,X);');
    hh2=uimenu('label','VALEURS RAIES','foregroundcolor','r','callback','[MOG,preci,voie]=impression(MOG,K,X);');
    hh3=uimenu('label','CHANGER DE FENETRE','foregroundcolor','r','callback','delete(figure(2));[X,K]=fft_calcul(DEF,x);');
    hh4=uimenu('label','NOUVEAU SIGNAL','foregroundcolor','r',...
        'callback','delete(figure(1));delete(figure(2));[MOG,x,X,K]=fft_nouveau_signal(MOG,DEF);');
    hh5=uimenu('label','NOUVELLE FFT','foregroundcolor','r',...
        'callback','delete(figure(1));delete(figure(2));[MOG,DEF]=fft_page1(fe,m);');
   % hh6=uimenu('label','Echelle en dB','foregroundcolor','r','callback','delete(gcf);[K,X]=fenetre_dB(c,x,DEF);');
end;
%pause
set(gcf,'toolbar','figure')
boutonchoix_echelle=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0,0.95,0.1,0.05],...
	    'string','Echelle dBV','foregroundcolor','r','fontunits','normalized','fontsize',0.4,'fontweight','bold',...
       'callback','delete(figure(2));[K,X]=fenetre_dB(c,x,DEF);');
bouton_spectrebi=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0,0.9,0.1,0.05],...
	    'string','Spectre bilatral','foregroundcolor','r','fontunits','normalized','fontsize',0.4,'fontweight','bold',...
       'callback','delete(figure(2));[Kbi,Xbi]=fenetre_bi(K,X,DEF,c);');

Contact us