How to extract results from ans of solve command?

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

Réponses (1)

Andrew Newell
Andrew Newell le 8 Déc 2014
Modifié(e) : Andrew Newell le 8 Déc 2014
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

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Produits

Tags

Question posée :

le 8 Déc 2014

Modifié(e) :

le 8 Déc 2014

Community Treasure Hunt

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

Start Hunting!

Translated by