⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 analpf_int.sci.svn-base

📁 基于自由软件Scilab/Scicos的通信原理仿真工具箱--Scicom0.2
💻 SVN-BASE
字号:
function [x,y,typ]=analpf_int(job,arg1,arg2)	x=[];y=[];typ=[]	select job		case 'plot' then  			standard_draw(arg1)		case 'getinputs' then  			[x,y,typ]=standard_inputs(arg1)		case 'getoutputs' then  			[x,y,typ]=standard_outputs(arg1)		case 'getorigin' then  			[x,y]=standard_origin(arg1)		case 'set' then			//plot(sin(1:100))  			x=arg1;  			graphics=arg1.graphics;exprs=graphics.exprs  			model=arg1.model;  			x0=model.state  			rpar=model.rpar  			ns=prod(size(x0));nin=1;nout=1  			s=poly(0,'s');z=poly(0,'s')  			while %t do      		//set the parameters of the low pass filter				//parameter window:				//order:				//filter type,input: 0(butt),1(cheb1),2(cheb2),3(ellip):				//passband ripple:				//stopband ripple:				//cutoff frequency(in radius):    			[ok,order, fType, passRp, stopRp, omega, exprs]=getvalue(..					'Set analog low pass filter parameters',..					['order';	 				'filter type,input: 0(butt),1(cheb1),2(cheb2),3(ellip)';					'passband ripple';					'stopband ripple';					'cutoff frequency(in radius)'],..					list('vec',1,'vec',1, 'vec',1,'vec',1, 'vec',1),exprs)				order=ceil(order);				fType = round(fType);    			if ~ok then break,end    			if order < 1 then      			message('Order of the filter must a be positive integer')      			ok=%f    			elseif (fType > 3 | fType < 0) then					message('Type of the filter must be 0,1,2 or 3')					ok=%f    			elseif (passRp < 0 | passRp > 1) then					message('Ripple must between 0 and 1')					ok=%f    			elseif (stopRp < 0 | stopRp > 1) then					message('Ripple must between 0 and 1')					ok=%f    			elseif (omega <= 0 ) then					message('cutoff frequency must be positive')					ok=%f    			end				    			if ok then      			fdesign = [];					select fType						case 0 then fdesign = 'butt'						case 1 then fdesign = 'cheb1'						case 2 then fdesign = 'cheb2'						case 3 then fdesign = 'ellip'					end					hs = analpf(order, fdesign, [passRp stopRp], omega);      			H=cont_frm(hs(2),hs(3))					//hs2 = ss2tr(H)					message(["transfer function of the filter:";pol2str(hs(2));"/" ;pol2str(hs(3))])					//figure(1);					//fr=linspace(0, 3*omega, 300);					//hm=abs(freq(hs(2),hs(3),%i*fr));					//plot2d(fr,hm, leg=["frequency response of low pass filter with transfer function:";pol2str(hs)])					[A,B,C,D]=H(2:5);      								graphics.exprs=exprs;      			[ns1,ns1]=size(A)      			rpar=[matrix(A,ns1*ns1,1);	    				matrix(B,ns1,1);	    				matrix(C,ns1,1);	    			D]      			if norm(D,1)<>0 then						mmm=[%t %t];      			else						mmm=[%f %t];      			end      			if or(model.dep_ut<>mmm) then 	  					model.dep_ut=mmm,end      			if ns1<=ns then						x0=x0(1:ns1)      			else						x0(ns1,1)=0      			end      			model.state=x0      			model.rpar=rpar      			x.graphics=graphics;x.model=model      			break    			end  			end		case 'define' then  			x0=0;A=-1;B=1;C=1;D=0;  			exprs=['1';'0';'0.1';'0.1';'2']  			model=scicos_model()  			model.sim=list('csslti4',4)  			model.in=1  			model.out=1  			model.state=x0  			model.rpar=[A(:);B(:);C(:);D(:)]  			model.blocktype='c'  			model.dep_ut=[%f %t]  			gr_i=['xstringb(orig(1),orig(2),[''analog low'';''pass filter''],sz(1),sz(2),''fill'')']  			x=standard_define([2.5 2.5],model,exprs,gr_i)	endendfunction

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -