SOLVE with symbolic and non symbolic variables
1 次查看(过去 30 天)
显示 更早的评论
Hello everybody!
I would like to solve a system with 5 symbolic-variables. The muneric values in the ecuación are also variables that come from other calculations.
I made this way...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
as=0.4
ds=0.04318
n=2
j=0.9
nu_3=0.25
epsilon_st=1.15
% This are the values that come from other calculations and I should use them in the system.
syms y_a Eta a_sw f_eta
eq1=sym('y_a=0.5 *(as-Eta*(as-ds))')
eq2=sym('a_sw=(2*y_a/sind(180/n))*(sqrt((1-2*y_a/as)/(2*y_a/as))/atand(sqrt((1-2*y_a/as)/(2*y_a/as))))')
eq3=sym('f_eta=as*nu_3/a_sw')
eq4=sym('j=sqrt((Eta^3+epsilon_st*Eta)/((1+epsilon_st)*f_eta))')
eq5=sym('as*nu_3=ds/sind(180/n)*sqrt(as/ds-1)/atand(sqrt(as/ds-1))')
Solucion = solve(eq1,eq2,eq3,eq4,eq5)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...and I am getting this prolblem:
Warning: Explicit solution could not be found. > In solve at 160
Should I define the problem in other way? Somebody Knows what am I doing not rigth?
Thanks a lot!, David
1 个评论
回答(1 个)
Star Strider
2012-9-6
You need to make some changes in your code.
First, change all the sind and atand to sin and atan. The Symbolic Math Toolbox doesn't recognize sind and atand.
Second, I suggest changing the single equals (=) to double equals (==) in your symbolic equations.
When I did this:
syms y_a Eta a_sw f_eta
eq1=sym('y_a==0.5 *(as-Eta*(as-ds))')
eq2=sym('a_sw==(2*y_a/sin(180/n))*(sqrt((1-2*y_a/as)/(2*y_a/as))/atan(sqrt((1-2*y_a/as)/(2*y_a/as))))')
eq3=sym('f_eta==as*nu_3/a_sw')
eq4=sym('j==sqrt((Eta^3+epsilon_st*Eta)/((1+epsilon_st)*f_eta))')
eq5=sym('as*nu_3==ds/sin(180/n)*sqrt(as/ds-1)/atan(sqrt(as/ds-1))')
Solucion = solve(eq1,eq2,eq3,eq4,eq5)
I was able to get expressions for:
Solucion.f_eta
Solucion.j
Solucion.n
Solucion.nu_3
Solucion.y_a
You will have to do subs or eval to get your constants into your equations, then do simplify(collect(expand(...))) on the elements of ‘Solucion’ to make them readable.
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!