error using solve for equation with one unknown

조회 수: 11 (최근 30일)
Andrei Costache
Andrei Costache 2014년 12월 8일
댓글: Andrei Costache 2014년 12월 8일
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!

답변 (1개)

Zoltán Csáti
Zoltán Csáti 2014년 12월 8일
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
Zoltán Csáti
Zoltán Csáti 2014년 12월 8일
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 2014년 12월 8일
Thank you!

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

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by