From: "qi li" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: solving equation of multiple exponent terms summation with variable 'z'
Date: Tue, 6 Mar 2012 08:40:13 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <jj4ihd$lca$>
References: <jivlej$sg2$>
Reply-To: "qi li" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1331023213 21898 (6 Mar 2012 08:40:13 GMT)
NNTP-Posting-Date: Tue, 6 Mar 2012 08:40:13 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1732016
Xref: comp.soft-sys.matlab:760028

     Thanks for replying, I think indeed first plotting 's' as a function of z to get approximation initial value of z , then using fzero() to solve equation is a method, but I must plot a deformation sphere,not just a single z value, that means given a grid [X,Y]=meshgrid(-10:10,-10:10), there should be  2*20*20=800 z values, each is a results of the equation, I can not use a method to probing z axis points one by one to get approximation initial position only for single result! It's too slowly. 
      I tried to use taylor series to approximate exponent expression in MATLAB, the details is first define symbolic variable z, and reserve the for-loop parts, but replace expression s with symbolic function taylor(): (default expand term is 6, y can define explicitly in n taylor(eq, n))
[x y]=meshgrid(-1:0.1:1,-1:0.1:1);
syms z
for i=1:3 s=s+taylor(exp(((x-a(1,i))^2+(y-a(2,i))^2+(z-a(3,i))^2)/(-2))); endafter step complete, I used 
to get all polynomial coefficients ,at last, I used  
but the results was very bad, the most commonly result is complex number, very few is real, the higher taylor expand terms I reserved, the more complex results would appear, when I substitute real number to s use subs(s,z, results), there was a huge distance from 0. who can give me a good idea how to solve the equation? Thanks very much!