Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: I have 51 linear equations, consisting of 51 unknowns. How to solve it in Matlab by using matrix?
Replies: 4   Last Post: May 28, 2013 10:45 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: I have 51 linear equations, consisting of 51 unknowns. How to solve it in Matlab by using matrix?
Posted: May 28, 2013 10:45 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"J K" <chemical2romance90@yahoo.com> wrote in message
news:knvthf$87h$1@newscl01ah.mathworks.com...
>> What do you mean by "separate the equations"?
>
> Let say I have 3 equations with 3 unknowns.
> 1x1 + 2x2 + 3x3 = 100
> 4x1+ 5x2 + 6x3 = 200
> 7x1 + 8x2 + 9x3 = 300
>
> Normally in Matlab, you will do this command in order to solve x1,x2,x3
>
> p=[1 2 3; 4 5 7; 7 8 9]'
> q=[100 200 300]'
> x=inv(p)*q
>
> But let's say I don't want to use the method/way that I write. What other
> options that I have in order to solve for the 51 unknowns?


If you want to leave the equations in the equation form (the first section
above) instead of converting them into the matrix-based form (the second
section above), you could do this using SOLVE from Symbolic Math Toolbox. If
that's not an option then you MUST convert them from the equation form to
the matrix form to solve them, and as Matt J said you should use the
backslash operator NOT the INV function to solve the system.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.