liuyang5299 发表于 2010-11-13 13:20:49

符号方程求解(提示找不到解答)

syms x a
solve('2*x*3.14-sin(2*x*3.14)-2*a=0',x)
请网友帮忙解答一下,是不是该方程无解析解

qibbxxt 发表于 2010-11-13 13:31:53

Warning: Explicit solution could not be found.这不就是找不到解析解的意思吗?

liuyang5299 发表于 2010-11-13 13:38:54

2# qibbxxt
请问能利用数值解来解吗 谢谢

zhouyang664 发表于 2010-11-13 14:14:36

显然可以,但不知你的a是变量还是常数呢?
help - fsolve

qibbxxt 发表于 2010-11-13 15:45:46

3# liuyang5299 >> f=@(x,a)2*x*3.14-sin(2*x*3.14)-2*a

f =

@(x,a)2*x*3.14-sin(2*x*3.14)-2*a

>> fplot(@(x)f(x,1),[-3,3])
>> fzero(@(x)f(x,1),0)

ans =

0.4067

>> grid on
>> grid minor

Walker0728 发表于 2010-11-13 15:49:23

我觉得你的方程好像有问题,用solve或是fsolve都能不能求解,你可以看看帮助文档
SOLVESymbolic solution of algebraic equations.
    SOLVE('eqn1','eqn2',...,'eqnN')
    SOLVE('eqn1','eqn2',...,'eqnN','var1,var2,...,varN')
    SOLVE('eqn1','eqn2',...,'eqnN','var1','var2',...'varN')

    The eqns are symbolic expressions or strings specifying equations.The
    vars are symbolic variables or strings specifying the unknown variables.
    SOLVE seeks zeros of the expressions or solutions of the equations.
    If not specified, the unknowns in the system are determined by FINDSYM.
    If no analytical solution is found and the number of equations equals
    the number of dependent variables, a numeric solution is attempted.

    Three different types of output are possible.For one equation and one
    output, the resulting solution is returned, with multiple solutions to
    a nonlinear equation in a symbolic vector.For several equations and
    an equal number of outputs, the results are sorted in lexicographic
    order and assigned to the outputs.For several equations and a single
    output, a structure containing the solutions is returned.

    Examples:

       solve('p*sin(x) = r') chooses 'x' as the unknown and returns

         ans =
         asin(r/p)

       = solve('x^2 + x*y + y = 3','x^2 - 4*x + 3 = 0') returns

         x =
         [ 1]
         [ 3]

         y =
         [    1]
         [ -3/2]

       S = solve('x^2*y^2 - 2*x - 1 = 0','x^2 - y^2 - 1 = 0') returns
       the solutions in a structure.

         S =
         x:
         y:

       = solve('a*u^2 + v^2 = 0','u - v = 1') regards 'a' as a
       parameter and solves the two equations for u and v.

       S = solve('a*u^2 + v^2','u - v = 1','a,u') regards 'v' as a
       parameter, solves the two equations, and returns S.a and S.u.

       = solve('a*u^2 + v^2','u - v = 1','a^2 - 5*a + 6') solves
       the three equations for a, u and v.
我看上面的例子就有符合你的方程的形式,你可以换用其他类似的方程试试

liuyang5299 发表于 2010-11-13 19:11:44

4# zhouyang664
a是常数,用a来表示x

lin2009 发表于 2010-11-13 23:41:50

可以参考:http://forum.simwe.com/thread-902236-2-1.html27#的方法求数值解。
f = @(x, a) 2*x*3.14 - sin(2*x*3.14) - 2*a;
g = @(a) fzero(@(x)f(x, a), 0);

subplot(2, 1, 1);
fplot(@(x)f(x, 1), [ 0, 5 ]);% 5# qibbxxt 的程序

a = linspace(0, 5, 100);   
y = arrayfun(g, a);             % 对于一组a,求出对应的根y
subplot(2, 1, 2);
plot(a, y);
http://home.simwe.com/attachment/201011/13/418800_128966285166Xe.jpg

zhouyang664 发表于 2010-11-14 23:34:52

楼上几位正解!
但不是很理解,楼主说:a是常数,用a来表示x,那岂不是说必须用符号求解,不能用数值方法,但符号解又没有闭式表达式,我看楼主要悲剧了...
楼主将就一下,参考楼上用数值解法吧...

liuyang5299 发表于 2010-11-19 18:41:56

9# zhouyang664
谢谢以上朋友的回复和解答。
如果能给出一个x(a)表达式,近似的能够逼近真实解也可以。数值解,能否给出定义域范围的关系式?

lin2009 发表于 2010-11-19 23:17:25

本帖最后由 lin2009 于 2010-11-19 23:22 编辑

用Maple来解有一个结果0.1592356688*RootOf(_Z-2*a-sin(_Z)) ,但却不是“闭式表达式”。
实际上判断根的情况,可以结合图形来分析:
可以将 2*x*3.14-sin(2*x*3.14)-2*a = 0的实根
看成是曲线y1(x) =2*x*3.14 - 2*a 与曲线 y2(x) =sin(2*x*3.14)的交点。
因此画出二者的曲线,就可以判断根的情况和定义域。
从图可知,定义域 -inf < a < inf。
http://home.simwe.com/attachment/201011/19/418800_12901796585Xsg.jpg
页: [1]
查看完整版本: 符号方程求解(提示找不到解答)