SOLVE with symbolic and non symbolic variables

1 visualizzazione (ultimi 30 giorni)
David Dapuero
David Dapuero il 6 Set 2012
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 Commento
Azzi Abdelmalek
Azzi Abdelmalek il 6 Set 2012
what are your unknowns variales, it seems that you have 4 four 5 equations

Accedi per commentare.

Risposte (1)

Star Strider
Star Strider il 6 Set 2012
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.

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by