function IOPs = RB03_invert(rrs,wavelength);
%
% function IOPs = RB03_invert(rrs,wavelength);
% input is RRS(0-) at X wavelengths...outputs are 6 retrieval params
% chl, acdom443, anap443, bbpratio, cp443, gamma
% R(nspec,nlambda)
% from Roesler and Boss 2003, GRL
%
disp('----------MAKE SURE RRS IS BELOW AIR-WATER INTERFACE--------------')
global rrs_obs wave
wave=wavelength;
options = optimset('fminsearch');
options = optimset(options,'tolx',1e-6,'tolfun',1e-6,'MaxFunEvals',4000,'MaxIter',4000);

%%%%%% FOR EACH SPECTRUM, INVERT USING RB03 TO GIVE IOP's

for i = 1:size(rrs,1), i
   rrs_obs = rrs(i,:)';
   [X cost(i)] = fminsearch('RB03_cost',[1 1 1 1 .01 0]); %af ag an cp bbratio gamma
   IOPs(i,:) = X;
end


