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!