About solve function in Symbolic Math Toolbox
1 view (last 30 days)
Show older comments
Hi,
I am using the Symbolic Math Toolbox to solve a linear system of equations. After solving it, I am getting the following result for one of the variables:
>> vpa(s.C2)
ans =
0.0000000069099524659921582499451534399493*q2 +
0.0000000069099524659921582499451534399493*q3 +
0.0074738045872171184378875461963896
I just one to get the coefficient of the first term, the coefficient of the second term and the third term of that solution and assign them to a variable, say, a(1), a(2) and a(3), respectively, so I have:
a(1)=0.0000000069099524659921582499451534399493;
a(2)=0.0000000069099524659921582499451534399493;
a(3)=0.0074738045872171184378875461963896;
Is there any way to do this?
Thank you!
0 Comments
Accepted Answer
Sean de Wolski
on 6 Jun 2013
syms x
y = vpa('pi*x+exp(1)*x^2')
a = coeffs(y)
In general to discover this stuff I would recommend using:
methodsview(y)
This will show you all of the available methods for the output.
0 Comments
More Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!