Home > bioelectromagnetism > elec_sphere_fit_optim.m

elec_sphere_fit_optim - Optimization for elec_sphere_fit.m Called from elec_sphere_fit.m

0001 function [f] = elec_sphere_fit_optim(r, X, Y, Z, xo, yo, zo) 0002 0003 % elec_sphere_fit_optim - Optimization for elec_sphere_fit.m 0004 % 0005 % Called from elec_sphere_fit.m 0006 % 0007 0008 % $Revision: 1.1 $ $Date: 2005/07/12 21:43:56 $ 0009 0010 % Licence: GNU GPL, no implied or express warranties 0011 % History: 02/2002, Darren.Weber_at_radiology.ucsf.edu 0012 % 0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0014 0015 % with center (Xo,Yo,Zo) and radius r, the equation of a sphere is: 0016 % 0017 % r^2 = (x-xo)^2 + (y-yo)^2 + (z-zo)^2 0018 % 0019 % This function below creates a scalar value to 0020 % return to the fminsearch function in elec_sphere_fit. 0021 0022 S = (X-xo).^2 + (Y-yo).^2 + (Z-zo).^2 - r^2; 0023 0024 f = sum( S.^2 );

Generated on Mon 15-Aug-2005 15:36:19 by