SOLVE with symbolic and non symbolic variables
조회 수: 3 (최근 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
Azzi Abdelmalek
2012년 9월 6일
what are your unknowns variales, it seems that you have 4 four 5 equations
답변 (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!