【问题标题】:How can I simplify in Matlab?Matlab如何简化?
【发布时间】:2013-03-28 06:56:07
【问题描述】:

我想简化以下操作,但它会产生一个错误,提示:输入参数过多。谁能告诉我我做错了什么???

>> 
syms a b c d e  f g h i j k l x y xy

A=[1 a b a^2 a*b b^2; 1 c d c*2 c*d d^2; 1 e f e^2 e*f f^2; 1 g h g^2 g*h h^2; 1 i j         i^2 i*j j^2; 1 k l k^2 k*l l^2]

B=[1; 0; 0; 0; 0; 0]

A =

[ 1, a, b, a^2, a*b, b^2]
[ 1, c, d, 2*c, c*d, d^2]
[ 1, e, f, e^2, e*f, f^2]
[ 1, g, h, g^2, g*h, h^2]
[ 1, i, j, i^2, i*j, j^2]
[ 1, k, l, k^2, k*l, l^2]


B =

 1
 0
 0
 0
 0
 0

>> simplify(inv(A)*B, 'steps', 100)enter code here

【问题讨论】:

    标签: matlab simplify


    【解决方案1】:

    我已将您粘贴的代码放入我的 matlab (R2013a) 副本中,它完成后没有任何错误。结果并没有很简化。

    如果您的计算机在计算时出现阻塞(它很长),您可以尝试将这些东西分开一点,看看是否有帮助。

    vec=inv(A)*B
    for n=1:6
        results(n)=simplify(vec(n), 'steps', 100);
    end
    results
    

    【讨论】:

      【解决方案2】:

      您的电话属于this MATLAB function

      但它在符号数学工具箱中,这意味着它只能简化数学公式而不是复杂的矩阵计算。

      Simplify Favoring Real Numbers
      
      To force simplify favor real values over complex values, set the value of Criterion to preferReal:
      
      syms x
      f = (exp(x + exp(-x*i)/2 - exp(x*i)/2)*i)/2 - (exp(- x - exp(-x*i)/2 + exp(x*i)/2)*i)/2;
      simplify(f, 'Criterion','preferReal', 'Steps', 100)
      ans =
      cos(sin(x))*sinh(x)*i + sin(sin(x))*cosh(x)
      If x is a real value, then this form of expression explicitly shows the real and imaginary parts.
      
      Although the result returned by simplify with the default setting for Criterion is shorter, here the complex value is a parameter of the sine function:
      
      simplify(f, 'Steps', 100)
      ans =
      sin(x*i + sin(x))
      

      相反,我认为您可以尝试使用this function: 简化(f, Steps = numberOfSteps)

      但首先,您需要一个“f”,它可以像递归或迭代函数一样使用。

      例如Simplify(sin(x)^2 + cos(x)^2, All)

      希望这会有所帮助!

      【讨论】:

        猜你喜欢
        • 2012-09-27
        • 1970-01-01
        • 2012-02-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多