http://www.mathworks.com/matlabcentral/newsreader/view_thread/309479
MATLAB Central Newsreader  symbolic equation coefficients
Feed for thread: symbolic equation coefficients
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Mon, 20 Jun 2011 15:33:04 +0000
symbolic equation coefficients
http://www.mathworks.com/matlabcentral/newsreader/view_thread/309479#841990
Elliot
PROBLEM BACKGROUND<br>
Im writing a code for the Finite Volume method and at some point I have a set of equations with symbolic terms and their coefficients, for each cluster. A cluster being defined as the group of cells surrounding a given vertex.<br>
<br>
i.e. 2a + 3b + 4c + 5d etc.<br>
<br>
The set of equations is stored in a vector, i.e. call the equation above 'A' the vector, <br>
[A<br>
B<br>
C<br>
D]; etc<br>
<br>
represent the system of equations for each cluster.<br>
<br>
I am also working in unstructured meshes, therefore, the size of the cluster (number of cells attached to the vertex) can technically be any number. So the vector containing the set of equations can be any length depending on the cluster size. The number of symbolic terms and coefficients per equation is equal to the length of the vector containing the set of equations.<br>
<br>
AIM<br>
I need to extract the coefficients from each line and store them in a global matrix.<br>
<br>
ISSUES<br>
When using 'coeffs', the coefficients are stored in some order I cannot determine, i.e. they are not stored corresponding to how they are found in the equation (a,b,c,d), they are not stored in numerical order. So using 'coeffs' does gove me the correct coefficients, however, their connectivity to the global matrix is lost because I dont know how 'coeffs' orders its results.<br>
<br>
I have tried looking for each symbolic term's coefficient ,using 'coeffs(A,a)' for example, but MATLab doesnt recognise the symbolic term 'a' in the function 'coeffs' even though it is defined previously as a symbolic term.<br>
<br>
Thanks for any help offered

Mon, 20 Jun 2011 17:26:27 +0000
Re: symbolic equation coefficients
http://www.mathworks.com/matlabcentral/newsreader/view_thread/309479#842018
Steven_Lord
<br>
<br>
"Elliot " <436277@swansea.ac.uk> wrote in message <br>
news:itnp7g$pj9$1@newscl01ah.mathworks.com...<br>
<br>
*snip*<br>
<br>
> When using 'coeffs', the coefficients are stored in some order I cannot <br>
> determine, i.e. they are not stored corresponding to how they are found in <br>
> the equation (a,b,c,d), they are not stored in numerical order. So using <br>
> 'coeffs' does gove me the correct coefficients, however, their <br>
> connectivity to the global matrix is lost because I dont know how 'coeffs' <br>
> orders its results.<br>
<br>
Use the two output form of COEFFS.<br>
<br>
 <br>
Steve Lord<br>
slord@mathworks.com<br>
To contact Technical Support use the Contact Us link on <br>
<a href="http://www.mathworks.com">http://www.mathworks.com</a>

Mon, 20 Jun 2011 17:28:04 +0000
Re: symbolic equation coefficients
http://www.mathworks.com/matlabcentral/newsreader/view_thread/309479#842019
Roger Stafford
"Elliot" wrote in message <itnp7g$pj9$1@newscl01ah.mathworks.com>...<br>
> When using 'coeffs', the coefficients are stored in some order I cannot determine, i.e. they are not stored corresponding to how they are found in the equation (a,b,c,d), they are not stored in numerical order. So using 'coeffs' does gove me the correct coefficients, however, their connectivity to the global matrix is lost because I dont know how 'coeffs' orders its results.<br>
> <br>
> I have tried looking for each symbolic term's coefficient ,using 'coeffs(A,a)' for example, but MATLab doesnt recognise the symbolic term 'a' in the function 'coeffs' even though it is defined previously as a symbolic term.<br>
> <br>
> Thanks for any help offered<br>
          <br>
I didn't completely understand the description of your problem. The 'coeffs' function is supposed to apply to polynomials.<br>
<br>
The documentation for 'coeffs' says, "[C, T] = coeffs(p, x) returns a list of the coefficients and a list of the terms of p. There is a onetoone correspondence between the coefficients and the terms of p." Is that of any use to you?<br>
<br>
Roger Stafford