set("figure_style","new") //create a figure in entity mode f=get("current_figure") //get the handle on the Figure entity f.figure_size = [1000, 700]; TCL_EvalStr([ 'destroy .top1' // supprime eventuellement la fenetre top1 'set w1 [toplevel .top1]' // creation de la fenetre top1 'set m 0.5' 'set fm 1' 'set fp 40']) TCL_EvalStr('scale $w1.echellem -from 1 -to 0 -length 200 -label m -orient vertical -tickinterval 0.1 ... -command {ScilabEval ""TraceCourbe""} -variable m -relief groove -showvalue true ... -borderwidth 4 -resolution 0.1') TCL_EvalStr('scale $w1.echelleFm -from 10 -to 1 -length 200 -label {fm (kHz)} -orient vertical -tickinterval 1 ... -command {ScilabEval ""TraceCourbe""} -variable fm -relief groove -showvalue true ... -borderwidth 4 -resolution 1') TCL_EvalStr('scale $w1.echelleFp -from 70 -to 30 -length 200 -label {fp (kHz)} -orient vertical -tickinterval 10 ... -command {ScilabEval ""TraceCourbe""} -variable fp -relief groove -showvalue true ... -borderwidth 4 -resolution 5') TCL_EvalStr('pack $w1.echellem $w1.echelleFm $w1.echelleFp') function TraceCourbe m=TCL_GetVar('m'); mprintf('m=%s\n',m); m=evstr(m) fm=TCL_GetVar('fm'); fm=evstr(fm) fp=TCL_GetVar('fp'); fp=evstr(fp) TraceCourbe2(m,fm,fp) endfunction function TraceCourbe2(m,fm,fp) N=2000; // nombre d'echantillons Fe=1000; // Frequence d'echantillonnage // x signal MA for i = 1:1:N; t(i)= i/Fe; info(i)=sin(2*%pi*fm*t(i)); x(i) = (1+m*info(i))*sin(2*%pi*fp*t(i)); // signal MA end; // Affichage du signal MA xset("pixmap",1); // graphique dessiné sur un pixmap clf(); subplot(2,1,1); xmax=N/Fe; plot2d(t,[(1+m*info) x],rect=[0, -2.2, xmax, 2.2]); e1=gce();// Get current entity handle. xtitle("signal MA et son emveloppe","t (ms)","Amplitude'); // Spectre du signal informatif f=Fe/N*(0:(N-1)); // pas en frequence Sinfo=2/N*fft(info,-1); //compute the fft // "Spectre" du signal MA f=Fe/N*(0:(N-1)); // pas en frequence Spectre=2/N*fft(x,-1); //compute the fft // Affichage des spectres subplot(2,1,2); xmax=85; // frequence max 85kHz plot2d3(f,[abs(Sinfo) abs(Spectre)],rect=[0, 0, xmax, 1.2]); e2=gce();// Get current entity handle. e2.children(1).foreground=2; // pointe la derniere courbe tracee : 5 red e2.children(2).foreground=5; // pointe l'avant derniee courbe tracee : 3 green e2.children(1).thickness=3; // : 4 light blue e2.children(2).thickness=3; // : 2 dark blue e1.children(1).foreground=2; // 5 red e1.children(2).foreground=5; // 3 green xtitle("spectre de bande de base et du signal MA","Fréquence kHz","Amplitude'); xset("wshow"); // Affichage du pixmap endfunction