Solve system of equations dependent on parameter
Show older comments
I want to solve a system of linear equations in Matlab. The problem is that this system will have a non-unique solution in general ( so the Nullspace is non-trivial) and this system depends on a parameter beta(non-zero!), that I don't want to specify in advance. Hence, I want to have the solution in terms of this parameter. Is MATLAB able to do this? In what way would I need to enter the equations and the parameter and which command would I need to use so that Matlab gives me all solutions? Could anybody here give me an idea how I would need to do this? Thanks to all of you.
4 Comments
Matt J
on 10 May 2014
Hence, I want to have the solution in terms of this parameter
In the case where the solution is non-unique, what do you consider to be "the" solution? Also, is the system square?
Star Strider
on 10 May 2014
Do you have the Symbolic Math Toolbox?
Simon Becker
on 10 May 2014
Star Strider
on 10 May 2014
The Symbolic Toolbox might make it possible for you to simplify it more easily than manually.
Accepted Answer
More Answers (1)
John D'Errico
on 10 May 2014
You will need the symbolic toolbox for anything more than what you can do with pencil and paper. Easy enough with it though.
syms x y z beta
xyz = solve(2*x + beta*y + 2*beta*z - 2,-x + 3*y + 2*z - beta,x,y,z)
Warning: 2 equations in 3 variables. New variables might be introduced.
> In /Applications/MATLAB_R2014a.app/toolbox/symbolic/symbolic/symengine.p>symengine at 56
In mupadengine.mupadengine>mupadengine.evalin at 97
In mupadengine.mupadengine>mupadengine.feval at 150
In solve at 170
Warning: The solutions are parametrized by the symbols:
z1 = C_
> In solve at 190
xyz =
x: [1x1 sym]
y: [1x1 sym]
z: [1x1 sym]
The solution is in xyz, where each of x,y,z depend on the unknown parameter z1.
xyz.x
ans =
-(beta^2 + 4*z1*beta - 6)/(beta + 6)
xyz.y
ans =
(2*(beta - 2*z1 - beta*z1 + 1))/(beta + 6)
xyz.z
ans =
z1
1 Comment
Simon Becker
on 10 May 2014
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!