How to extract results from ans of solve command?

10 ビュー (過去 30 日間)
Luiz
Luiz 2014 年 12 月 8 日
編集済み: Andrew Newell 2014 年 12 月 8 日
Hi,
I've tried to solve a 2 equation system with the solve command and I don't know if it is possivle to extract vales from the answer. Please, what can be done?
syms n p Rs Rr An1 An2 Bn1 Bn2 mir theta Mn An1 Bn1
bc1=(n*p/Rs)*(An1*Rs^(n*p)+Bn1*Rs^(-n*p))*sin(n*p*theta)
bc2=(n*p*(sin(n*p*theta)*(An1*Rr^(n*p) + Bn1/Rr^(n*p)) - (Mn*Rr*sin(n*p*theta))/(mir*(n^2*p^2 - 1))))/Rr
solve (bc1, bc2, An1, Bn1)
ans =
An1: [1x1 sym]
Bn1: [1x1 sym]
Thank you,
Luiz Loureiro

回答 (1 件)

Andrew Newell
Andrew Newell 2014 年 12 月 8 日
編集済み: Andrew Newell 2014 年 12 月 8 日
First, it's a good idea to give a meaningful name to the output of solve:
sols = solve (bc1, bc2, An1, Bn1);
Now you can look at the solutions using
sols.An1
or
disp(sols.An1)
(which looks a little cleaner)
and
sols.Bn1

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by