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

📄 specfilter.m

📁 Spectral Element Method for wave propagation and rupture dynamics.
💻 M
字号:
%specfilter.m	Zero-phase Butterworth filter%		via spectral domain%% datout = specfilter(datin,samp,flo,fhi,ord)%	datin	Real input data, length must be 2^p%	samp	Sampling frequency%	flo	Low frequency cut-off (0 if no low filtering)%	fhi	High frequency cut-off (0 if no high filtering)%	ord	Filter order (small integer)function datout = specfilter(datin,SAMP,FLO,FHI,ORD)if any(size(datin)==1), datin = datin(:); end[Nin,nsis] = size(datin);N = 2^nextpow2(Nin);fdat = fft(datin,N);% build the filter in spectral domainord2 = 2*ORD ;% data is real, work with the positive frequenciesf = (0:N/2).' * SAMP/N ;% filter out low frequenciesif FLO > 0  filtLo = 1 - 1 ./ sqrt( 1 + (f/FLO).^ord2 ) ; else  filtLo = ones(N/2+1,1);end% filter out high frequenciesif FHI > 0  filtHi = 1 ./ sqrt( 1 + (f/FHI).^ord2 ) ; else  filtHi = ones(N/2+1,1);endfilt = filtHi .* filtLo ;% apply the filterfdat(1:N/2+1,:) = fdat(1:N/2+1,:) .* filt(:,ones(nsis,1)) ;% data is real, fill the negative frequenciesfdat(N/2+2:N,:) = conj( fdat(N/2:-1:2,:) );datout = real(ifft(fdat));datout = datout(1:Nin,:);

⌨️ 快捷键说明

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