SOLVE with symbolic and non symbolic variables
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Azzi Abdelmalek
el 6 de Sept. de 2012
what are your unknowns variales, it seems that you have 4 four 5 equations
Respuestas (1)
Star Strider
el 6 de Sept. de 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.
0 comentarios
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!