SOLVE with symbolic and non symbolic variables

조회 수: 3 (최근 30일)
David Dapuero
David Dapuero 2012년 9월 6일
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
Azzi Abdelmalek 2012년 9월 6일
what are your unknowns variales, it seems that you have 4 four 5 equations

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
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.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by