error using solve for equation with one unknown

4 visualizaciones (últimos 30 días)
Andrei Costache
Andrei Costache el 8 de Dic. de 2014
Comentada: Andrei Costache el 8 de Dic. de 2014
Hi!
I am triyng to solve for 'p' with the code:
g = linspace(0*(pi/180),180*(pi/180),10);
a = 0.7644;
b = 0.2101;
cof = 0.2;
eq = solve('(1+g)*cos(p*pi)*(sin(p*g)^2-p^2*sin(g)^2)+(1/2)*(1-a)*sin(p*pi)*(sin(2*p*g)+p*sin(2*g))+cof*sin(p*pi)*((1-a)*p*(1+p)*sin(g)^2-2*b*(sin(p*g)^2-p^2*sin(g)^2))','p');
u = subs(eq,g);
and I get the following error:
Warning: Cannot find explicit solution. > In solve at 319 In stress_int at 56 Error using symengine (line 58) Number of elements in NEW must match number in OLD.
Error in sym/subs>mupadsubs (line 139) G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 124) G = mupadsubs(F,X,Y);
Error in stress_int (line 57) u = subs(eq,g);
Any ideas why? Please help!

Respuestas (1)

Zoltán Csáti
Zoltán Csáti el 8 de Dic. de 2014
The values of a, b, cof are not retained in the string, so use
syms p
solve((1+g)*cos(p*pi)*(sin(p*g)^2-p^2*sin(g)^2)+(1/2)*(1-a)*sin(p*pi)*(sin(
2*p*g)+p*sin(2*g))+cof*sin(p*pi)*((1-a)*p*(1+p)*sin(g)^2-2*b*(sin(p*g)^2-p^2*sin(g)^2)),p);
instead. But g is a vector so you will get an overdetermined system.
  3 comentarios
Zoltán Csáti
Zoltán Csáti el 8 de Dic. de 2014
It returned the same warning for me too. It means, that the Symbolic Math Toolbox could not solve it for p. I tried it with Maple and that couldn't solve it either. So try to solve it numerically, you can't do other things.
Andrei Costache
Andrei Costache el 8 de Dic. de 2014
Thank you!

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by