function Mesh_T6(evalfun,c2range,c3range,tol) % Creates a contour map of ||evalfun||^2 % Inputs: % evalfun String that names a function M-file for % evaluating error coefficients given c2 and c3 % c2range Two parameter vectors specifying lowest and highest % & c3 range values of c2 and c3 to be plotted % tol Maximum viewable value of above ratio % Default value is 1 % Reduce tol to focus area on minimums % Default mesh spacing is 1/100 the difference in c2range & c3range C2spacing = (c2range(2)-c2range(1))/100; C3spacing = (c3range(2)-c3range(1))/100; C2 = c2range(1):C2spacing:c2range(2); C3 = c3range(1):C3spacing:c3range(2); if nargin < 4 tol = 1; end for i = c2range(1):C2spacing:c2range(2) for j = c3range(1):C3spacing:c3range(2) t = feval(evalfun,i,j); ifix = int16((i-c2range(1))/C2spacing+1); %ifix integer value from 1 to 101 jfix = int16((j-c3range(1))/C3spacing+1); %jfix integer value from 1 to 101 Z(jfix,ifix) = sum(t.^2); % sum of squares if (Z(jfix,ifix) > tol) Z(jfix,ifix) = tol; end end end mesh(C2,C3,Z); xlabel('c2') ylabel('c3') zlabel('sum of squares') end