//--------------------------------------------------------------------------- // // Example of the design of first order nonlinear filters for the // approximation of the norm of the output signal of a linear second // order SISO filter through optimal synthesis. // // Developed for Scilab 2.6. // // Rio de Janeiro, June 05, 2002. // // Author: Jose' Paulo V. S. da Cunha // //--------------------------------------------------------------------------- // Filter in this example: G1(s) = 10/[(s+1)(s+2)]. // Cascade realization of G1(s): A=[-1 1 ; 0 -2 ] B=[0; 1] C = [10 0] G1=syslin('c',A,B,C); // Impulse response of G1(s): t=0:0.05:5; G1_impulse = abs(csim('impulse',t,G1)); G1_impulse(1) = abs(C*B); // Optimal synthesis: disp('Design parameters:'); delta_l = 0.1 delta_u = 0.1 epsilon1 = 0.1 epsilon2 = 0.000001 ho = 10 [c,Gamma,c_gamma_max,gamma_max,c_delta_l,ttime,g_norm]=first_order_filter(A,B,C,delta_u,delta_l,epsilon1,epsilon2,ho); disp('FOAF optimal parameters:'); c Gamma S_min = c/Gamma c_gamma_max gamma_max S_gamma_max = c_gamma_max/gamma_max c_delta_l delta_l S_gamma_min = c_delta_l/delta_l // Impulse responses: S_min_impulse = csim('impulse',t,syslin('c',-Gamma,1,c)); S_min_impulse(1) = c; gamma_max_impulse = csim('impulse',t,syslin('c',-gamma_max,1,c_gamma_max)); gamma_max_impulse(1) = c_gamma_max; gamma_min_impulse = csim('impulse',t,syslin('c',-delta_l,1,c_delta_l)); gamma_min_impulse(1) = c_delta_l; // Ploting impulse responses: xbasc(); xset("default"); xset("font size",4); xset("line style",1); plot2d(t',[G1_impulse' gamma_max_impulse' S_min_impulse' gamma_min_impulse']); xtitle('','time (s)','Impulse response norm');