function [R]=pkares(k,h,obsdata)
	k=abs(k);
	k1=[k 0]'; k2=[0 k]';
%	f=@(c,h) k1./(k1+h).^2-k2./(k2+h).^2; %octave version
	g=@(h,c) k1./(k1+h).^2-k2./(k2+h).^2; %octave version
	tmp_k1=size(k1); %matlab hack
	c0=[1-k(1)/(k(1)+h(1)) k(1)/(k(1)+h(1)) zeros(1,tmp_k1(1)-2)]; %yield initial guesses for concs
	[junk,C]=ode45(g,h,c0); %octave version
%	C=lsode(f,c0,h); %octave version
	R=obsdata-C*pinv(C)*obsdata;
	R=sum(sum(sqrt(R.^2)));
end
