scs_m.props.context=[ 'Te=1;' 'Nbsampl=2^16;' 'Tfin=Nbsampl*Te;' 'Nbit=16;' 'a=0.5;' 'b=-2.5;' 'ci=0.675;' 'Intmax = 2^(Nbit-1);' 'ci1=-int(ci*Intmax);' 'ci2=int(ci*Intmax);' 'p_source=2*%pi/(4*Te);' 'a_source=2^(Nbit-2);' 'sigma=0'];
//Define simulation name sim_name='lin_chua_teb_sim'; //Load scicos diagram load(MODNUMCOS+'/examples/simu/'+sim_name+'/'+sim_name+'.cos') //Define context exec(MODNUMCOS+'/examples/simu/'+sim_name+'/'+sim_name+'_ctxt.sce'); context=scs_m.props("context");execstr(context); //Define Simulation end time scs_m.props.tf=Tfin; //Define other variable //sig_log=10:2.5:32.5; sig_log=8:2:24; sig=[]; for k=1:size(sig_log,2) sig(k)=1/(10^(sig_log(k)/10)); end nb_r=size(sig,1); teb=[];nb_error=[]; l=0 while l<2 for j=1:nb_r //define context variable to be sweep scs_m.props.context(13)='sigma='+string(sig(j))+'*Te'; //Initialise Info and %scicos_context variable Info=list(); if ~exists('%scicos_context') then %scicos_context=struct(); end //Disp Begin simulation date printf("Begin simulation %d, \t %s\n",j,return_date()); //Do simulation with scicos_simulate Info=scicos_simulate(scs_m,Info,%scicos_context,"nw"); //Save result myvar=return_state_block(Info,"toto"); nb_error(j)=myvar(1)(1); //Processed result teb(j)=nb_error(j)/(Nbsampl*Nbit); //Disp processed result and end simulation time printf("Processed Teb(%d) = %f\n",j,teb(j)); printf("End simulation %d, \t %s\n\n",j,return_date()); end l=l+1 end //Plot result plot_teb(49,sig_log,teb,"1");