About solve function in Symbolic Math Toolbox
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!