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

📄 smooth.m

📁 基于Matlab的地震数据处理显示和测井数据显示于处理的小程序
💻 M
字号:
function avin=smooth(in,dist)% Function computes average over "dist" samples of matrix "in". "dist" must be greater% than or equal to 1, but need not be integer% Written by: E. R.:% Last updated: July 14, 2003: modified end condition to assure that mean of columns is not changed%%        avin=smooth(in,dist)% INPUT% in     matrix whose columns should be averaged% dist   "distance" in terms of samples over which to average% OUTPUT% avout  matrix with averaged columns (same size as "in"). At both ends of the column%        vectors the averaging is performed over fewer samples% SEE ALSO: binsmooth% EXAMPLE%         a=[1,0,0,0,1,0,0,0,1]'%         smooth(a,3)if dist == 1  avin=in;  returnend[n,m]=size(in);if n == 1  in=in';  [n,m]=deal(m,n);  flip=1;else  flip=0;endin=full(in);%       Create an odd smoothing filteridist=2*fix((dist-1)/2)+1;xdist=dist-idist;if xdist == 0  weights=ones(dist,1)/dist;else  weights=ones(idist+2,1);  weights([1,end])=0.5*xdist;  weights=weights/dist;endif length(weights) > n  avin=mean(in);  avin=avin(ones(n,1),:);  returnendappend=(length(weights)-1)/2;avin=zeros(n,m);for ii=1:size(in,2)  temp1=conv(in(:,ii),weights);  avin(:,ii)=temp1(append+1:end-append);end%       Repair wrong scaling at ends of data setsfor ii=1:append  %fact=1/sum(weights(1:end-append-1+ii));  %avin(ii,:)=avin(ii,:)*fact;  %avin(end-ii+1,:)=avin(end-ii+1,:)*fact;  fact=sum(weights(1:append+1-ii));  avin(ii,:)=avin(ii,:)+in(ii,:)*fact;  avin(end-ii+1,:)=avin(end-ii+1,:)+in(end-ii+1,:)*fact;endif flip  avin=avin';end

⌨️ 快捷键说明

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