matlab中 simple函数

为什么将y化简会出错
2024-12-30 06:59:41
推荐回答(3个)
回答1:

  我运行没问题呀,可能是精简版功能不齐全,要不你试试加上syms x

  • >> y=sym('2*sin(x)*cos(x)');
    >> y
    y =
    2*cos(x)*sin(x)
    >> simple(y)
    simplify:
    sin(2*x)
    radsimp:
    2*cos(x)*sin(x)
    simplify(100):
    sin(2*x)
    combine(sincos):
    sin(2*x)
    combine(sinhcosh):
    2*cos(x)*sin(x)
    combine(ln):
    2*cos(x)*sin(x)
    factor:
    2*cos(x)*sin(x)
    expand:
    2*cos(x)*sin(x)
    combine:
    2*cos(x)*sin(x)
    rewrite(exp):
    2*((1/exp(x*i))/2 + exp(x*i)/2)*(((1/exp(x*i))*i)/2 - (exp(x*i)*i)/2)
    rewrite(sincos):
    2*cos(x)*sin(x)
    rewrite(sinhcosh):
    2*cosh(-x*i)*sinh(-x*i)*i
    rewrite(tan):
    -(4*tan(x/2)*(tan(x/2)^2 - 1))/(tan(x/2)^2 + 1)^2
    mwcos2sin:
    -2*sin(x)*(2*sin(x/2)^2 - 1)
    collect(x):
    2*cos(x)*sin(x)
    ans =
    sin(2*x)

回答2:

应加上syms x

回答3:

>> syms x;
y=sym('2*sin(x)*cos(x)');
y=simple(y)

y =

sin(2*x)