function sumsqerr = SumSqrErr(LoRp,varparams,INPUTS) % this function returns the summ of squared errors for PxRp corresponding % to the given set of values LoRp, the variable parameters, bovers0 and % sigap, and the dimensions and material properties contained in INPUTS. % The experimental values for PxRp are in dims{6} (dims is INPUTS{3}) and % the theoretical values are returned by the function DoCellMuFit. % Before evaluating sumsqerr for this iteration, we set up the current PxRp % set for comparison with thetheoretical values, and we update CBETA for the % current iteration value of b/s0 contained in varparams. dims = INPUTS{3}; PxRp = dims{6}; PROPS = INPUTS{2}; % update PROPS {5} for the current value of b. PROPS{5} = varparams(1); % put the updated value into INPUTS to be carried into subsequent % calculations INPUTS{2} = PROPS; PxRp_th = DoCellMu_Fitdpar(LoRp,varparams,INPUTS); SqrErr = (PxRp - PxRp_th).^2; sumsqerr = sum(SqrErr); disp(['Current: b,sigap,Lmax,SSQERR = ',num2str(varparams(1)),', ',num2str(varparams(2)),', ',num2str(varparams(3)) ... ,', ',num2str(sumsqerr)]); close all; toc %close(1); %close(2); %close(3);