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 Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by