About solve function in Symbolic Math Toolbox

조회 수: 1 (최근 30일)
Ricardo Prada
Ricardo Prada 2013년 6월 6일
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!

채택된 답변

Sean de Wolski
Sean de Wolski 2013년 6월 6일
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개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by