How to extract results from ans of solve command?
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!