Code covered by the BSD License  

Highlights from
Co-Blade: Software for Analysis and Design of Composite Blades

image thumbnail

Co-Blade: Software for Analysis and Design of Composite Blades

by

 

18 Sep 2012 (Updated )

Analysis and design of composite blades for wind and hydrokinetic turbines

findClosest(x, val)
function [ind r] = findClosest(x, val)
% this function finds the index of the closest value within a vector
% x MUST be a sorted vector with unique values

N   = length(val);
ind = zeros(N,1);
r   = zeros(N,1);
for n = 1:N
    [r(n) ind(n)] = min( abs(x - val(n)) );
end

end % function findClosest

Contact us