


Smooth a vertex-based field using averages
[field] = function smoothfield(fieldin,Mobj,SmoothFactor,nLoops,SmoothPts)
DESCRIPTION:
Smooth a vertex based field
INPUT
Mobj = Matlab mesh object
fieldin = vertex based field
scale = scale in grid coordinates over which to calc trunc value
OUTPUT:
field = filtered, vertex-based field
EXAMPLE USAGE
Mobj.h = smoothfield(Mobj.h,Mobj,1000)
Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Revision history
==============================================================================

0001 function [field] = truncfield(fieldin,Mobj,scale) 0002 0003 % Smooth a vertex-based field using averages 0004 % 0005 % [field] = function smoothfield(fieldin,Mobj,SmoothFactor,nLoops,SmoothPts) 0006 % 0007 % DESCRIPTION: 0008 % Smooth a vertex based field 0009 % 0010 % INPUT 0011 % Mobj = Matlab mesh object 0012 % fieldin = vertex based field 0013 % scale = scale in grid coordinates over which to calc trunc value 0014 % 0015 % OUTPUT: 0016 % field = filtered, vertex-based field 0017 % 0018 % EXAMPLE USAGE 0019 % Mobj.h = smoothfield(Mobj.h,Mobj,1000) 0020 % 0021 % Author(s): 0022 % Geoff Cowles (University of Massachusetts Dartmouth) 0023 % 0024 % Revision history 0025 % 0026 %============================================================================== 0027 0028 %------------------------------------------------------------------------------ 0029 % Parse input 0030 %------------------------------------------------------------------------------ 0031 0032 if(exist('fieldin')*exist('Mobj')*exist('scale') == 0) 0033 error('arguments to truncfield are missing') 0034 end; 0035 0036 0037 0038 %------------------------------------------------------------------------------ 0039 % Smoothing Loops 0040 %------------------------------------------------------------------------------ 0041 m = Mobj.nVerts; 0042 for i=1:m 0043 radlist(1:m,1) = sqrt((Mobj.x(1:m)-Mobj.x(i)).^2 + (Mobj.y(1:m)-Mobj.y(i)).^2); 0044 ipts = find(radlist < scale); 0045 fieldmin = min(abs(fieldin(ipts))); 0046 field(i) = fieldmin; 0047 end; 0048