
[Sponsors] 
March 28, 2011, 16:47 
[MATLAB] 9 equations, 9 unknowns

#1 
New Member
Romain
Join Date: Jun 2010
Location: Lyon
Posts: 28
Rep Power: 8 
Hello,
I do not know anything about matlab but I have a rather complicated problem to solve, and I'm afraid that Excel will not suffice to solve it, so I was wondering if there was not an algorithm that could solve my system with Matlab. Using AX = Y with my matrix A, which contains unknowns (sadly!), my X vector containing the values that I seek, my solution vector Y (also with one unknow, X7...), I can get the following system: Do you think that I could solve it ? Thank you for your help! 

March 28, 2011, 18:24 

#2 
New Member

Invert the matrix and multiply that by the solution vector to get X19.
if its Ax = b then do x = inv(A)*b b must be a column vector. 

March 28, 2011, 18:42 

#3 
Senior Member
Join Date: Apr 2009
Posts: 129
Rep Power: 9 
You have more than 9 unknowns; furthermore, Excel will not be able to handle your constants in matrix A.
Looks like you need to symbolically solve a nonlinear system of equations, try the symbolic toolbox in MATLAB: http://www.mathworks.com/help/toolbo...lic/solve.html 

March 29, 2011, 03:32 

#4 
New Member
Romain
Join Date: Jun 2010
Location: Lyon
Posts: 28
Rep Power: 8 
I can't use X=inv(A)*b since it's nonlinear. I have somes unknowns in both X,Y (Y6=l+l*exp(gm)*exp(gX7) with X7 unknown) and in my matrix (M(8,8)=f*X7k, M(9,9)=exp(gm)*exp(gX7)).
So I should try "solve(eq1, eq2, ..., eq9)" without using a matrix ? Or, I could use my matrix to define each of my equations, like eq1=M(1,1)*X1+M(1,2)*X2+M(1,3)*X3, eq2=M(2,1)*X1... Last edited by nakor; March 29, 2011 at 03:52. 

March 29, 2011, 08:25 

#5 
New Member

Did you try what fw suggested? If that doesn't work then try solving them as individual equations.


March 29, 2011, 08:38 

#6 
New Member
Romain
Join Date: Jun 2010
Location: Lyon
Posts: 28
Rep Power: 8 
It could not work. It is a system, it will not work if I try to solve each equation individually.
I will try with "solve(eq1, eq2, ..., eq9)" as fw suggested. 

March 29, 2011, 12:28 

#7 
Senior Member
Martin Hegedus
Join Date: Feb 2011
Posts: 474
Rep Power: 11 
Why not just reduce the matrix, at least partially, by hand and see what it gets you?
By adding and subtracting various rows you can remove X4 and X6. Once that is done, maybe a couple other columns could go. 

March 29, 2011, 13:42 

#8 
Senior Member
Martin Hegedus
Join Date: Feb 2011
Posts: 474
Rep Power: 11 
Ooops, meant to say X5 instead of X4.
What you are looking to do is create a column with all 0s except one value. X5 is one such column already. X5 is dependent on the other variables, but none of the other equations are dependent on it. Once you add equation 8 to 7, then the same is true for X6. The goal is a triangular matrix by doing elimination and switching rows and columns. 

March 30, 2011, 07:06 

#9 
New Member
Romain
Join Date: Jun 2010
Location: Lyon
Posts: 28
Rep Power: 8 
Thanks Martin, I think I found something way easier to solve.
I just have to found X9 first, then X8, X7... X1. It's even linear since I will know X7 when I will try to solve X4 and X3. Can I use matlab to solve this system ? Last edited by nakor; March 30, 2011 at 10:15. 

March 30, 2011, 12:48 

#10 
Senior Member
Martin Hegedus
Join Date: Feb 2011
Posts: 474
Rep Power: 11 
I don't think matlab can solve it since I don't believe it does symbolic math. You'll need to use something like mathmatica. Or do it by hand.
One thing you can try, and I'm not sure this will work, is to take a look at equation 9 of your original matrix and take a best guess at the values for X7 and X9. From that equation is seems the best values may be that both are equal to l. However, it doesn't appear that a value of l for X9 would work in your reduced matrix. 

March 31, 2011, 07:33 

#11 
New Member
g srinivas
Join Date: Mar 2011
Posts: 2
Rep Power: 0 
u can try data fit software
by using multiple functions such as F1(s), F2(s) 

April 2, 2011, 09:44 

#12 
Senior Member
Jonas T. Holdeman, Jr.
Join Date: Mar 2009
Location: Knoxville, Tennessee
Posts: 108
Rep Power: 10 
MATLAB has an addon symbolic toolkit that uses the MAPLE kernel for symbolic computations. I have not used this toolkit, but routinely use MAPLE. MAPLE has a very good linear symbolic solver that can solve linear equations with 100200 variables in a few seconds. The MAPLE nonlinear solver can take a very long time with a smaller number of variables.
A suggestion would be to solve the linear subset of equations in terms of the nonlinear variables, then substitute solution into the nonlinear set (using the "subs" command) giving a smaller number of nonlinear equations. This is what Martin Hedegus was suggesting doing by hand. If the nonlinear solver cannot return a solution, then perhaps the smaller set of nonlinear equations can be simplified using some approximations, say for large or small limits of certain variables. Often the nonlinear symbolic solver returns multiple solutions. For instance if you have a square root, there may be different solutions depending on the sign of the root. Unfortunately, if the (linear) solver fails there is no information about why it failed, though this is usually due to inconsistent equations. 

April 2, 2011, 10:28 

#13 
Senior Member
Jonas T. Holdeman, Jr.
Join Date: Mar 2009
Location: Knoxville, Tennessee
Posts: 108
Rep Power: 10 
A further thought. Simplify by replacing h1=exp(h), gm=exp(g*m), and renormizing X7'=X7/g .
In the simplified/reduced nonlinear equations, replace combinations of parameters appearing as coefficients by new parameters. For small g, approximate exp(g*X7) by 1+g*X7 to linearize this term. The solver has to make the most general assumptions about the parameters and variables. Can you tell the solver that certain things are real, or positive, or negative? 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Guide: Writing Equations in LaTeX on the CFD Online Forums  pete  Site Help, Feedback & Discussions  20  June 16, 2015 13:52 
Question about UDS equations  tstorm  FLUENT  1  January 11, 2010 14:02 
Maths problem when deriving conservation of energy equations.  Demonwolf  Main CFD Forum  1  June 15, 2009 14:21 
? fluctuating equations for homogenous shear turb.  ff_fan  Main CFD Forum  1  September 20, 2002 07:39 
Euler equations?  Jan Ramboer  Main CFD Forum  2  August 19, 1999 01:58 