Code covered by the BSD License  

Highlights from
Huygens-Fresnel integral approximation, free-form apertures and rough surfaces

image thumbnail

Huygens-Fresnel integral approximation, free-form apertures and rough surfaces

by

 

Simulate wave propagation through free-form apertures, or off rough surfaces.

checkGrid(obj)
function obj = checkGrid(obj)
% checkGrid - compute size, number of grid points and resolution

if isempty(obj.nGrid)
	if ~isempty(obj.size) && ~isempty(obj.resolution)
		displayMessage(2, [obj.name ': number of grid points']);
		obj.nGrid = round(obj.size(:) ./ obj.resolution(:)) + 1;
	else
		displayMessage(-1, [obj.name ': ERROR missing parameters ''size'' or ''resolution''']);
	end
elseif isempty(obj.size)
	if ~isempty(obj.nGrid) && ~isempty(obj.resolution)
		displayMessage(2, [obj.name ': grid size']);
		obj.size = (obj.nGrid(:)-1) .* obj.resolution(:);
	else
		displayMessage(-1, [obj.name ': ERROR missing parameters ''nGrid'' or ''resolution''']);
	end
elseif isempty(obj.resolution)
	if ~isempty(obj.size) && ~isempty(obj.nGrid)
		displayMessage(2, [obj.name ': resolution']);
		obj.resolution = obj.size(:) ./ (obj.nGrid(:) - 1);
	else
		displayMessage(-1, [obj.name ': ERROR missing parameters ''nGrid'' or ''grid''']);
	end	
end

Contact us