Home > bioelectromagnetism > elec_ellipse_fit_optim.m

elec_ellipse_fit_optim

PURPOSE ^

elec_ellipse_fit_optim - Optimization for elec_ellipse_fit.m

SYNOPSIS ^

function [f] = elec_ellipse_fit_optim(r, X, Y, Z, xo, yo, zo)

DESCRIPTION ^

 elec_ellipse_fit_optim - Optimization for elec_ellipse_fit.m

 Called from elec_ellipse_fit.m

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [f] = elec_ellipse_fit_optim(r, X, Y, Z, xo, yo, zo)
0002 
0003 % elec_ellipse_fit_optim - Optimization for elec_ellipse_fit.m
0004 %
0005 % Called from elec_ellipse_fit.m
0006 %
0007 
0008 % $Revision: 1.1 $ $Date: 2005/07/12 21:51:07 $
0009 
0010 % Licence:  GNU GPL, no implied or express warranties
0011 % History:  02/2002, Darren.Weber_at_radiology.ucsf.edu
0012 %
0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0014 
0015 % r is a 3x1 vector of radius values for each x,y,z axis component of
0016 % ellipse
0017 %
0018 % equation of ellipsoid with center (xo,yo,zo) and radius for each axis (x,y,z) = (a,b,c):
0019 % (( x - xo )^2 / a^2) + (( y - yo )^2 / b^2) + (( z - zo )^2 / c^2) = 1
0020 %
0021 % This function below creates a scalar value to
0022 % return to the fminsearch function in elec_ellipse_fit.
0023 
0024 E = ( (X-xo).^2 )/r(1).^2 + ((Y-yo).^2)/r(2).^2 + ((Z-zo).^2)/r(3).^2  - 1;
0025 
0026 f = sum( E .* E );  % sum of squares returned
0027 
0028 return

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003