MATLAB Answers

How to extract results from ans of solve command?

21 views (last 30 days)
Luiz
Luiz on 8 Dec 2014
Edited: Andrew Newell on 8 Dec 2014
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

  0 Comments

Sign in to comment.

Answers (1)

Andrew Newell
Andrew Newell on 8 Dec 2014
Edited: Andrew Newell on 8 Dec 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

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags

Products


Translated by