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

bode_mc.m
global courbes br_freq br_puls val_max val_min nb_pt super nb_simul
global retard nom bloc
%[nom bloc]=get_param;
nom=get_param(0,'CurrentSystem') ;
bloc=get_param(nom,'CurrentBlock');
[x,lin]=testin(nom,bloc);
if x==0
	h_f=figure('unit','pixel','pos',[386 336 340 200],...
	           'name','ERREUR','color','w');
	set(0,'currentf',h_f);
	h_a=axes;
	set(h_a,'xcolor','w','ycolor','w')
	axis([0 1 0 1]);
	text(0.4,0.9,'ERREUR !','color','r')
	text(.1,0.75,'Entre(s) non dfinie(s)','color','k')
 	text(.1,0.5,'Utiliser un bloc INPORT','color','k')
	%text(.1,0.25,'(Bibliothque ''Rponse Harmonique'')','color','k')
	bouton=uicontrol(gcf,'style','push','position',[10 10 100 25],...
	          'string','OK','callback','close(h_f)');
	return
end;
[x,lout]=testout(nom,bloc);
if x==0
	h_f=figure('unit','pixel','pos',[386 336 340 200],...
	           'name','ERREUR','color','w');
	set(0,'currentf',h_f);
	h_a=axes;
	set(h_a,'xcolor','w','ycolor','w')
	axis([0 1 0 1]);
	text(0.4,0.9,'ERREUR !','color','r')
	text(.1,0.75,'Sortie(s) non dfinie(s)','color','k')
 	text(.1,0.5,'Utiliser un bloc OUTPORT','color','k')
	%text(.1,0.25,'(Bibliothque ''Rponse Harmonique'')','color','k')
	bouton=uicontrol(gcf,'style','push','position',[10 10 100 25],...
	          'string','OK','callback','close(h_f)');
	return
end;
nmin=floor(log10(min([FA,FP])/10));
nmax=ceil(log10(max([FA,FP])*10));
%f=logspace(nmin,nmax,10000);
fdepart=10^nmin;
ffin=10^nmax;
h_f=figure('color','w','name','ANALYSE DE MONTE CARLO');
set(0,'currentf',h_f);
if isempty(courbes)
	courbes=[0 0 0];
end;
super=1;
if (isempty(br_puls) & isempty(br_freq))
	br_puls=0;
	br_freq=1;
end;
if isempty(val_min)
	val_min=num2str(fdepart);
end;
if isempty(val_max)
	val_max=num2str(ffin);
end;
if isempty(nb_pt)
	nb_pt='1000';
end;
if isempty(nb_simul)
    nb_simul_s='10';
end;    
nb_simul=10;
txt_titre=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.2 0.9 0.6 0.05],'backgroundcolor','w',...
	           'foregroundcolor','r','string','DIAGRAMMES DE BODE');
txt_bode=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.1 0.8 0.3 0.05],'backgroundcolor','y',...
	           'foregroundcolor','r','string','choix des courbes');
txt_bode=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.1 0.75 0.3 0.05],'backgroundcolor','y',...
	           'foregroundcolor','r','string','               ');
b_gain=uicontrol(gcf,'style','checkbox','unit','normalized',...
		'position',[0.1 0.7 0.3 0.05],'backgroundcolor','y',...
	          'foregroundcolor','r','string','GAIN',...
                  'value',courbes(1),...
		'callback',['if get(b_gain,''value'')==1,',...
			     'courbes(1)=1;',...
			      'else,',...
			      'courbes(1)=0;',...
			       'end']);
b_phase=uicontrol(gcf,'style','checkbox','unit','normalized',...
		  'position',[0.1 0.65 0.3 0.05],'backgroundcolor','y',...
	          'foregroundcolor','r','string','ARGUMENT',...
		   'value',courbes(2),...		
		   'callback',['if get(b_phase,''value'')==1,',...
			     'courbes(2)=1;',...
			      'else,',...
			      'courbes(2)=0;',...
			       'end']);
b_deux=uicontrol(gcf,'style','checkbox','unit','normalized',...
		'position',[0.1 0.6 0.3 0.05],'backgroundcolor','y',...
	          'foregroundcolor','r','string','LES DEUX',...
		  'value',courbes(3),...
		'callback',['if get(b_deux,''value'')==1,',...
			     'courbes(3)=1;',...
			      'else,',...
			      'courbes(3)=0;',...
			       'end']);
txt_freq=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.5 0.8 0.3 0.05],'backgroundcolor','y',...
	           'foregroundcolor','r','string','Abscisses');
r_freq=uicontrol(gcf,'style','radio','unit','normalized',...
		'position',[0.5 0.75 0.3 0.05],'backgroundcolor','y',...
		'foregroundcolor','r','string','frquences en Hz',...
		'value',br_freq,...
		'callback',['set(r_freq,''value'',1);',...
		'set(r_puls,''value'',0);','br_freq=1;','br_puls=0;']);
r_puls=uicontrol(gcf,'style','radio','unit','normalized',...
		'position',[0.5 0.70 0.3 0.05],'backgroundcolor','y',...
		'foregroundcolor','r','string','pulsations en rad/s',...
		'value',br_puls,...
		'callback',['set(r_freq,''value'',0);',...
		'set(r_puls,''value'',1);','br_freq=0;','br_puls=1;']);
txt_mc=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.1 0.5 0.3 0.05],'backgroundcolor','g',...
	           'foregroundcolor','b','string','Nombre de simulations');
ed_mc=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.1 0.45 0.3 0.05],'backgroundcolor','g',...
	          'foregroundcolor','b','max',1,...
		'string',nb_simul_s,...
    'callback','nb_simul=str2num(get(ed_mc,''string''));');
txt_val=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.5 0.5 0.3 0.05],'backgroundcolor','g',...
	           'foregroundcolor','b','string','VALEURS :');
s='min';
txt_min=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.5 0.45 0.3 0.05],'backgroundcolor','g',...
	           'foregroundcolor','b','string',s);
ed_min=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.8 0.45 0.3 0.05],'backgroundcolor','g',...
	           'foregroundcolor','b','max',1,...
		'string',val_min,...
		'callback','val_min=get(ed_min,''string'');');
s='max';
txt_max=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.5 0.4 0.3 0.05],'backgroundcolor','g',...
	           'foregroundcolor','b','string',s);
ed_max=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.8 0.4 0.3 0.05],'backgroundcolor','g',...
	           'foregroundcolor','b','max',1,...
		'string',val_max,...
		'callback','val_max=get(ed_max,''string'');');
txt_nb=uicontrol(gcf,'style','text','unit','normalized',...
		'position',[0.5 0.35 0.3 0.05],'backgroundcolor','g',...
	           'foregroundcolor','b','string','nb de points');
ed_nb=uicontrol(gcf,'style','edit','unit','normalized',...
		'position',[0.8 0.35 0.3 0.05],'backgroundcolor','g',...
	           'foregroundcolor','b','max',1,...
		'string',nb_pt,...
		'callback','nb_pt=get(ed_nb,''string'');');

bouton=uicontrol(gcf,'style','push','unit','normalized',...
		'position',[0.1 0.1 0.1 0.1],...
	          'string','OK','callback',['close(h_f);','trace_bode_mc(courbes,br_freq,br_puls,val_max,val_min,nb_pt,1,nom,bloc,NUM,DEN,type_de_filtre,FA,FP,Amax,Amin,nb_simul,serie,A0_s,FT_s,S_s,VCC_s,RID_s,RS_s)']);

Contact us