Solve system of equations when symbolic vector is referencing its own elements?
1 view (last 30 days)
Show older comments
I have a script that prints out a symbolic vector "a" in terms of its elements a(1),...,a(n):
a =
2610.0 - 0.0001*a5 - 1.0e-6*a7 - 0.01*a3
- 0.02*a4 - 0.0003*a6 - 3027.0
1176.0 - 0.0007*a7 - 0.03333*a5
266.1 - 0.05*a6
- 0.07*a7 - 322.0
64.24
-1.701
"a" is a system of equations where the elements of "a" reference other elements of "a", e.g. a(2) references a(4) and a(6):
a(2) = - 0.02*a4 - 0.0003*a6 - 3027.0
I want to write a(1),a(2),...,a(n) without any symbols appearing on the right-hand side. In other words, I want to substitute numerical values into the elements of "a".
I've tried solve(), vpasolve(), and subs() but I can't format the output to replace the symbols inside each element.
What am I doing wrong?
Thanks,
Michael
0 Comments
Accepted Answer
Mischa Kim
on 31 Mar 2014
Edited: Mischa Kim
on 31 Mar 2014
Michael, use
syms a1 a2 a3 a4 a5 a6 a7
a = [a1 a2 a3 a4 a5 a6 a7]';
eq = [ 2610.0 - 0.0001*a5 - 1.0e-6*a7 - 0.01*a3,
-0.02*a4 - 0.0003*a6 - 3027.0,
1176.0 - 0.0007*a7 - 0.03333*a5,
266.1 - 0.05*a6,
-0.07*a7 - 322.0,
64.24,
-1.701];
sol = vpasolve(eq==a);
More Answers (0)
See Also
Categories
Find more on Assumptions 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!